python解决中文问题和yaml读文件
在后面加多:encoding=‘utf-8‘2Yaml读写:
import yamldef main():#读写解决中文:encoding=‘utf-8‘,allow_unicode=True data = {"GGG":{"kk":{"你好":["7","9"]}}}#生成text.yaml路径 with open("E:/pythonJIAO/test1/yaml/text.yaml","w",encoding=‘utf-8‘)as f: yaml.dump(data,f,allow_unicode=True)if __name__ == "__main__": main()
相关推荐
边城客栈学无止境 2020-07-05
awoyaoc 2020-06-07
mary 2020-05-28
ShiShuo 2020-05-16
OyangYujun 2020-04-10
kjh00abc 2020-03-08
sschencn 2020-02-23
akcsdno 2020-02-18
技术积累LZ 2020-02-14
SDUTACM 2020-01-18
jacktangj 2020-01-09
技术积累LZ 2020-01-08
limx 2019-12-18
kjh00abc 2019-12-15
Cherishyuu 2019-12-11
kjh00abc 2019-12-09