import yaml
import pprint
with open(r'learnyaml.yaml') as file:
# The FullLoader parameter handles the conversion from YAML
# scalar values to Python the dictionary format
yaml2 = yaml.load(file, Loader=yaml.FullLoader)
pprint.sorted = lambda x, key=None: x # disable sort in pprint
pp.pprint(yaml2) # this can pretty print the dict, but the output is unordered
print()
how to disable sort in pprint in python
猜你喜欢
转载自blog.csdn.net/lantianjialiang/article/details/103597705
今日推荐
周排行