def str_presenter(dmpr, data):
"""Return correct str_presenter to write multiple lines to a yaml field.
Source: http://stackoverflow.com/a/33300001
"""
if is_multiline(data):
return dmpr.represent_scalar('tag:yaml.org,2002:str', data, style='|')
return dmpr.represent_scalar('tag:yaml.org,2002:str', data)
评论列表
文章目录