# 读取已存在的某个文件内的内容
f = open('note.txt', 'r', encoding='utf-8')
s = f.readlines()
print(s)
f.close()
# 推荐使用以下方式 with...as :上下文管理
with open('note.txt', 'r', encoding='utf-8') as f:
print(f.readlines())
# 向文件中写入内容
with open('ab.txt','a+',encoding='utf-8') as file:
file.write('你好\n我好\n大家好\n写入练习----2022.6.15')