【python】利用Python读写文件中的内容

with open('note.txt','r',encoding='utf-8')as f:
print(f.readlines())
#读取!



#写入
with open('a.txt','w',encoding='utf-8') as a: #“w”
a.write('你好?')
a.write('\n你好?')
posted @ 2021-08-25 22:11  金涛拍岸  阅读(52)  评论(0)    收藏  举报