python学习次日-文件的读写

f=open('a.txt',encoding='utf-8')html result=f.read()post print(result)htm f.closeblog 写这个路径的时候最好前面加一个rutf-8 f=open(r'a.txt',encoding='utf-8') 前面加一个r防止转意class open就是打开文件,若是有中文就encoding='utf-8',有打开就有关闭还
相关文章
相关标签/搜索