标签:weight font pre open style size yam 问题 python
在后面加多:encoding=‘utf-8‘
2Yaml读写:
import yaml
def 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()
标签:weight font pre open style size yam 问题 python
原文地址:https://www.cnblogs.com/zenghongfei/p/12150601.html