C:\Users\user\python3_8\WPy64-3850\WinPython Command Prompt.exe
pip install opencv-python
 
		 
			 
		avcodec-59.dll avdevice-59.dll avfilter-8.dll avformat-59.dll avutil-57.dll ffmpeg.exe ffplay.exe ffprobe.exe postproc-56.dll swresample-4.dll swscale-6.dll
avcodec-59.dll avdevice-59.dll avfilter-8.dll avformat-59.dll avutil-57.dll ffmpeg.exe ffplay.exe ffprobe.exe postproc-56.dll sample.py swresample-4.dll swscale-6.dll
pip install ffmpeg
例
C:\Users\user\WinPython\WPy64-3950\scripts>pip install ffmpeg Collecting ffmpeg Downloading ffmpeg-1.4.tar.gz (5.1 kB) Building wheels for collected packages: ffmpeg Building wheel for ffmpeg (setup.py) ... done Created wheel for ffmpeg: filename=ffmpeg-1.4-py3-none-any.whl size=6084 sha256=d1cc1d2b21681f13264aeca8d45c5680bf94ee42783affac7a7de2bd7bd8d7dd Stored in directory: c:\users\user\appdata\local\pip\cache\wheels\1d\57\24\4eff6a03a9ea0e647568e8a5a0546cdf957e3cf005372c0245 Successfully built ffmpeg Installing collected packages: ffmpeg Successfully installed ffmpeg-1.4
pip install --upgrade pip --user
main.py
from ConfigX import ConfigX
print ('設定データの読み込み | iniファイルなどから設定を読み込む | confg')
configX = ConfigX()
confs =configX.getConfigs('./config.txt')
print(confs)
	ConfigX
# 設定データの取得
# auther kenji uehara
# version 1.0.0
# since 2021-11-5
class ConfigX:
    
    def getConfigs(self, text_fn):
        configs = {}
        
        # 設定ファイルを読み込み
        f = open(text_fn, 'r', encoding='UTF-8')
        text_all = f.read()
        f.close()
            
        lines = text_all.split('¥n')
        for line in lines:
            if ('=' in line) == False: continue
            field = self.__stringLeft(line, '=');
            field = field.strip()
            value = self.__stringRight(line, '=');
            value = value.strip()
            configs[field] = value
            
        return configs
    
    # 文字列を左側から印文字を検索し、左側の文字を切り出す
    # @param string s 対象文字列
    # @param $mark 印文字
    # @return 印文字から左側の文字列
    def __stringLeft(self, s, mark):
        a =s.find(mark)
        res = s[0:a]
        return res
    
    
    # 文字列を左側から印文字を検索し、右側の文字を切り出す。
    # @param string s 対象文字列
    # @param $mark 印文字
    # @return 印文字から右側の文字列
    def __stringRight(self, s, mark):
        a =s.find(mark)
        res = s[a+len(mark):]
        return res
        
	config.txt
#テスト設定ファイル animal = neko age = 16 power= https://amaraimusi.sakura.ne.jp/note_prg/a=123
出力
設定データの読み込み | iniファイルなどから設定を読み込む | conf
neko
16
https://amaraimusi.sakura.ne.jp/note_prg/a=123
{'animal': 'neko', 'age': '16', 'power': 'https://amaraimusi.sakura.ne.jp/note_prg/a=123'}
	
	
import datetime
print ('Pythonの覚書:現在日時を取得 | datetime')
dt = datetime.datetime.now()
u = dt.strftime("%Y%m%d%H%M%S")
print(type(dt))
print(dt)
print(u)
	Pythonの覚書:datetime <class 'datetime.datetime'> 2021-11-05 20:58:42.628284 20211105205842
print ('PythonでSQLite3を扱う')
import sqlite3
# データベースにアクセス、データベースファイルが存在しなければ生成しつつアクセス
dao = sqlite3.connect(
    "test5.sqlite3", #データベースのファイル名
    isolation_level=None, #Noneは自動コミットを表す
)
sql = """
    CREATE TABLE nekos (
        id INTEGER PRIMARY KEY AUTOINCREMENT, 
        neko_name VARCHAR(50),
        neko_age INTEGER
    );
"""
dao.execute(sql)     #sql文を実行
dao.execute("INSERT INTO nekos(neko_name, neko_age) VALUES ('イッパイアッテナ', 12);")  
# SELECT文の実行とデータ取得
res = dao.execute("SELECT * FROM nekos;")  
#data = res.fetchone() # 1行だけ取得
data = res.fetchall() # すべての行を取得
print(data)
dao.close()
	class_test.py(これをrunする) Animal(フォルダ) Dog.pyclass_test.py
from Animal.Dog import Dog # from フォルダ.クラスファイル名 import クラス名
	batta = Dog()
	batta.bark('臆病な犬')
	
class Dog:
    
    # コンストラクタ
    def __init__(self):
        print('犬のコンストラクタ')
        self.type_a = 'xxx' # publicメンバ
        self.__type_b = '犬科' # privateメンバ
    # publicメソッド
    def bark(self, animal_name):
        print(f'{animal_name}がほえる')
        print(self.type_a) # メンバにアクセス
        print(self.__type_b)
        print(self.__work()) # 同クラス内のメソッドの呼び出し
        
    # privateメソッド
    def __work(self):
        print('犬もあるけば棒にあたる')
	犬のコンストラクタ 哺乳類A 犬科 臆病な犬がほえる 犬もあるけば棒にあたる
class_test.py(これをrunする) Animal(フォルダ) Insect(フォルダ) Batta.pyclass_test.py
	from Animal.Insect.Batta import Batta
	
	batta = Batta()
	batta.jump('オンブバッタ')
	
	class Batta:
	    def __init__(self):
	        print('バッタのコンストラクタ')
	
	    def jump(self, animal_name):
	        print(f'{animal_name}が跳ねる')
	
import sys
sys.path.append("C:\\Users\\user\\git\\python_sample\\a001\\Animal\\Insect\\")
from Batta import Batta # from クラスファイル名 import クラス名
bata = Batta()
bata.jump('トノサマバッタ')
	
class Batta:
    def __init__(self):
        print('バッタのコンストラクタ')
    def jump(self, animal_name):
        print(f'{animal_name}が跳ねる')
	
	value1 = None