读取txt乱码

先使用rb二进制读取读取,文件然后使用decode进行转码

with open(CHECKPOINT + 'checkpoint.txt', 'rb') as f:
     self.step = str(f.read().decode('utf-8'))

猜你喜欢

转载自blog.csdn.net/qq_39124762/article/details/82945182