Python文件操作
打开文件并读取内容
file1 = open(file='abc', encoding='utf8')
contents = file1.read()
print(contents)
file1.close()
file_name = 'pi'
with open('pi', 'w', encoding='utf8') as file_object:
file_object.write('hello word\n')
file_object.write('hello word\n')
file_object.write('hello word\n')