📅  最后修改于: 2022-03-11 14:46:21.648000             🧑  作者: Mango
import yaml
dict_file = [{'sports' : ['soccer', 'football', 'basketball', 'cricket', 'hockey', 'table tennis']},
{'countries' : ['Pakistan', 'USA', 'India', 'China', 'Germany', 'France', 'Spain']}]
with open(r'E:\data\store_file.yaml', 'w') as file:
documents = yaml.dump(dict_file, file)