# pip install PyYAML
# write to file
f = open('update.yaml', 'w')
aproject = {'project1': {'Checksum' : checksum,
'Package': package,
'Version': version}}
yaml.dump(aproject, f, default_flow_style=False)
f.close()
# read and parse from file
f = open('update.yaml')
x = yaml.load(f)
print x
Reference :
PyYAML
yaml简介以及在python上的应用 - 继续迷糊 - ITeye技术网站
How can I create a yaml file from pure python? - Stack Overflow
沒有留言:
張貼留言