#读取整个文件
filename = './data/read.log'
with open(filename, 'r', encoding='utf-8') as file_object:contents = file_object.read()print(contents)#逐行读取
filename = './data/read.log'
with open(filename, 'r', encoding='utf-8') as file_object:for line in file_object:print(line)#读取文件内容为列表
filename = './data/read.log'
with open(filename, 'r', encoding='utf-8') as file_object:lines = file_object.readlines()for line in lines:print(line.rstrip())