原来程序是这样,我想打开num.txt这个文本,并且改名为file1.txt,但是一直报错
TypeError:‘encording’ is an invalid keyboard argument for this function
with open(‘num.txt’,‘r’,encording=‘utf-8’) as file1:
contents = file1.read()
print(contents)
查找一些资料,改了后
import io
with io.open(‘num.txt’,‘r’,encording=‘utf-8’) as file1:
contents = file1.read()
print(contents)
改完还是报错,求解
encoding,你打错字了
而且文件改名要用os.rename,你打开文件干什么