读取文件:TypeError: an integer is required (got type str)

读取文件的时候报错:

Traceback (most recent call last):
File "D:\Python35\test\csdn.py", line 46, in <module>
with open("test.txt","r","utf-8") as f:
TypeError: an integer is required (got type str)

 改成如下就好了

 with open("test.txt","r+","utf-8") as f: 

 问题解决。

posted on 2018-03-07 08:44  明日边缘-道法自然  阅读(3799)  评论(0编辑  收藏  举报