verify_files.py 文件源码

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

项目:Magic-Spoiler 作者: Cockatrice 项目源码 文件源码
def load_file(input_file, lib_to_use):
    try:
        with open(input_file) as data_file:
            if lib_to_use == 'yaml':
                output_file = yaml.safe_load(data_file)
            elif lib_to_use == 'yaml_multi':
                output_file = []
                for doc in yaml.safe_load_all(data_file):
                    output_file.append(doc)
            return output_file
    except Exception as ex:
        print "Unable to load file: " + input_file + "\nException information:\n" + str(ex.args)
        sys.exit("Unable to load file: " + input_file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号