item_conversion.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:smarthome 作者: smarthomeNG 项目源码 文件源码
def yaml_save(filename, data):
    """
    ***Converter Special ***

    Save contents of an OrderedDict structure to a yaml file

    :param filename: name of the yaml file to save to
    :param data: OrderedDict to save
    """

    sdata = convert_yaml(data)

    print(", saving to '{}'".format(os.path.basename(filename)+'.yaml'))
    if store_raw_output == True:
        with open(filename+'_raw.yaml', 'w') as outfile:
            outfile.write( sdata )

    # Test if roundtrip gives the same result
    data = yaml.load(sdata, yaml.RoundTripLoader)
    _yaml_save_roundtrip(filename, data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号