打开代码如下:
f=open("123.txt","rt","encode=utf-8")
for i in f:
i=i.split(",")
print(i)
报错如下:
=RESTART: C:\Users\Zz\AppData\Local\Programs\Python\Python38-32\program\practise11.py
Traceback (most recent call last):
File "C:\Users\Zz\AppData\Local\Programs\Python\Python38-32\program\practise11.py", line 1, in <module>
f=open("123.txt","rt","encode=utf-8")
TypeError: an integer is required (got type str)
``
这是我想打开输出的文件
另外,为什么我的文件里有逗号的话,open就需要写“encode=utf-8”?
求大神解答