数据结构
1、对象:键值对的集合,键值对用冒号“:”结构表示。
冒号与值之间需用空格分隔
2、数组:一组按序排列的值。
简称 “序列或列表”
数组前加有 “-” 符号,符号与值之间需用空格分隔
3、纯量:单个的、不可再分的值。
(如:字符串、bool值、整数、浮点数、时间、日期、null等)
None值可用null可 ~ 表示
实例
house: family: name: Doe parents: - John - Jane address: number: 34 street: Main Street import yaml f = open('example.ini',encoding="utf-8") x = yaml.load(f) print(x) print("---------") aproject = {'name': 'Silenthand Olleander', 'race': 'Human', 'traits': ['ONE_HAND', 'ONE_EYE'] } ret = yaml.dump(aproject) print(ret) aproject = ["a","b","c"] ret = yaml.dump(aproject) print(ret) aproject = ("a","b","c") ret = yaml.dump(aproject) print(ret) aproject = {"a":1,"b":2} ret = yaml.dump(aproject) print(ret)
神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试