from sys import argv
script,filename=argv
txt=open(filename)
print(f”here is your file {filename}”)
print(txt.read())
然后我在终端运行这个脚本,然后出现了这样的情况
zhangxiongdeMBP:practice xzz$ python3.6 zhanghuidongnk.py zhd.txt
here is your file zhd.txt
Traceback (most recent call last):
File “zhanghuidongnk.py”, line 8, in
print(txt.read())
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/codecs.py”, line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x9b in position 10: invalid start byte
求助大神这究竟是怎么回事