python yaml文件读写
import yaml yaml_dict={"sss":"111","ddd":"222"} with open("a.yaml", "w") as f: yaml.safe_dump(yaml_dict,f,encoding='utf-8', allow_unicode=True) with open("a.yaml") as f: yaml_dict = yaml.load(f) print(yaml_dict)
import yaml yaml_dict={"sss":"111","ddd":"222"} with open("a.yaml", "w") as f: yaml.safe_dump(yaml_dict,f,encoding='utf-8', allow_unicode=True) with open("a.yaml") as f: yaml_dict = yaml.load(f) print(yaml_dict)