py icon indicating copy to clipboard operation
py copied to clipboard

13_read_write

Open appleling00 opened this issue 4 years ago • 0 comments

13_read_write 中的代码在执行with open("poem.txt","r") as f:这句代码时,会报UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 659: illegal multibyte sequence 这样的错误 即使把代码更改成 with open("poem.txt",encoding='utf-8').read() as f: 也会报AttributeError: __enter__这样的错 明明 file 已经内置了对上下文管理协议的支持,可仍然要报错

appleling00 avatar Aug 08 '21 07:08 appleling00