美文网首页
python yaml格式化保存

python yaml格式化保存

作者: thinkpp | 来源:发表于2017-06-27 20:36 被阅读0次

    yaml

    yaml是什么呢?
    之前在ros上面做相机和imu标定的时候,都是用这个文件来存储信息的
    YAML是一种容易人类阅读、适合表示程序语言的数据结构、可用于不同程序间交换数据、支持泛型工具、支持串行处理、丰富的表达能力和可扩展性、易于使用的语言。YAML利用缩进或者是explicit indicatior(如{})来表示属性的嵌套,更为直观和simple。

    在Python 中的使用

     with open(dataset + r'/poses.yaml','w') as dumpfile:
            dumpfile.write(yaml.dump(poses))
    
    with open(dataset + r'/poses.yaml','r') as loadfile:
            poses = yaml.load(loadfile)
    

    为什么说它好呢,因为它的确好看。如下:

    yaml.png

    很好读懂,而且计算机也能很好的格式化处理

    相关文章

      网友评论

          本文标题:python yaml格式化保存

          本文链接:https://www.haomeiwen.com/subject/vgzecxtx.html