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()
好的心态+正确的方法