def write_configuration_file(filename, conf):
"""Write a config dict to the specified file, in yaml format"""
import shutil
try:
shutil.copy2(filename, '%s.back' % filename)
except IOError:
pass
try:
os.makedirs(os.path.dirname(filename))
except OSError:
pass
with open(filename, 'w') as filep:
yaml.dump(conf, filep, indent=4, default_flow_style=False, Dumper=Dumper)
评论列表
文章目录