文件文本的操作
import os
with open('a.txt','wb') as fp;
file = open('a.txt','w',encoding = 'utf-8') # w是覆盖并且重新写入
file.write('Python') # 文件的杜西呃怎么打印出来是个中文字符
# print(file.readlines()) #结果是一个list
file = open('a.txt','r+') # 一定要先读取,才能打印出来
print(file) # 打印出来的file应该是一个地址之类的
原创
2021-06-03 19:30:50 ·
120 阅读 ·
1 评论