【Python】ファイルを一行ずつ読み込む方法
サンプルソースコードSample.txt1行目:pythonファイル読込サンプル2行目:note3行目:サンプル
fileInput.py#手順1:ファイルを開くfileObject = open("Sample.txt", "r", encoding="utf_8")#手順2:ファイルを1行ずつ読み込むwhile True: l = fileObject.readline() if l: print(l) else: fileObject.close() br