使用以下代码:
with open("sd1file.txt",'r') as testfile:
file_contents = testfile.read
print (file_contents)
我得到这个错误
<built-in method read of _io.TextIOWrapper object at 0x02EEB4B0>
我可以用
file = open(testfile,'r')
等没有问题
i、 e.文件存在且可访问,即我可以对其进行读写
有什么模块需要导入吗
Tags:
您没有调用该方法
相关问题 更多 >
编程相关推荐