How to load yaml file in python

import yaml
#
call Cloader to speed up try: from yaml import CLoader as Loader except ImportError: from yaml import Loader try: file_handler = open(file) yaml content = yaml.load(file_handler, Loader=Loader) except IOError: LOG.error(' Failed to open file "%s"', file) finally: file_handler.close()

 

posted on 2022-02-11 18:37  guolongnv  阅读(37)  评论(0编辑  收藏  举报