当前位置 : 主页 > 编程语言 > python >

python编码问题:UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 68: illeg

来源:互联网 收集:自由互联 发布时间:2022-06-15
import yaml def test_yaml(): f = open('C:\hogwarts\Scripts\hogwarts-api\demo\yaml_data.yml') print(yaml.load(f)) # 改进:import yaml def test_yaml(): f = open('C:\hogwarts\Scripts\hogwarts-api\demo\yaml_data.yml','rb') print(yaml.load(f)


import yaml
def test_yaml():
f = open('C:\hogwarts\Scripts\hogwarts-api\demo\yaml_data.yml')
print(yaml.load(f))  

# 改进:import yaml
def test_yaml():
f = open('C:\hogwarts\Scripts\hogwarts-api\demo\yaml_data.yml','rb')
print(yaml.load(f))




网友评论