テキストファイル読込
with open('hello.txt', encoding='utf-8') as f:
print(f.read())
テキストファイルを一行ずつ読込
with open('hello.txt', encoding='utf-8') as f:
for line in f:
print(line.strip())
CSVファイルを読込
import csv
with open('hello2.txt', encoding='utf-8') as f:
# 戻り値は文字列のlist
csvred = csv.reader(f)
for line in csvred:
print(line)