摘要: # 读写模式 utf-8 正常# f = open('老人与海','r+',encoding='utf-8')# print(f.read())# f.write("a")# f.close()# 写读模式 utf-8 写进去的东西会覆盖之前的字符,读出来的就是覆盖之后剩余的字符# f = open 阅读全文
posted @ 2018-11-02 13:35 自由自在多快乐 阅读(153) 评论(0) 推荐(0) 编辑
摘要: #只读模式,文本,gb2312f = open('d:\老人与海.txt','r',encoding='gb2312')content = f.read()print(content)f.close()#只读模式 utf-8f = open('老人与海','r',encoding='utf-8')c 阅读全文
posted @ 2018-11-02 12:38 自由自在多快乐 阅读(209) 评论(0) 推荐(0) 编辑