Yaml

 

Msg.yamlspa

name: dz
age: 22
spoce:
    name: 安生
    age: 12
children:
    - name: 詹闊
      age: 13
    - name: 展闊
      age: 10utf-8

 

Xx.pyclass

file = open('msg.yaml','r',encoding='utf-8')
data = yaml.load(file)
print(data)coding

d = {'name':'zd'}
ls = [1,23,3]
eee = yaml.dump(d)
eee2 = yaml.dump(ls)
print(eee)
print(eee2)file

相關文章
相關標籤/搜索