YAML数据转换

1.数据转化

方法:dump()可以将Python对象序列化成YAML流,如果stream为None,则返回生成的字符串。

2.测试场景

将下面的Python数据转换成yaml数据类型

slogan=['welcome','to','baidu']

website=[‘url’:'www.baidu.com']

(十二)YAML数据转换

代码实现

(十二)YAML数据转换

 

 打印结果:

(十二)YAML数据转换

 

相关文章:

  • 2021-08-26
  • 2022-02-07
  • 2021-07-03
  • 2021-12-04
  • 2021-07-02
  • 2021-08-29
  • 2022-12-23
  • 2021-05-22
猜你喜欢
  • 2021-05-21
  • 2021-04-21
  • 2021-08-27
  • 2021-07-20
  • 2022-12-23
  • 2021-04-13
  • 2021-12-25
相关资源
相似解决方案