Yaml与python类型的对照表

因为常用yaml作为python程序的配置文件,特将其与python类型参照表在此贴出,以供温故之用。

 

 

YAML tag

Python type

Standard YAML tags

 

!!null

None

!!bool

bool

!!int

int

!!float

float

!!binary

str

!!timestamp

datetime.datetime

!!omap

!!pairs list of pairs

!!set

set

!!str

str

!!seq

list

!!map

dict

Python-specific tags

 

!!python/none

None

!!python/bool

bool

!!python/str

str

!!python/unicode

unicode

!!python/int

int

!!python/long

long

!!python/float

float

!!python/complex

complex

!!python/list

list

!!python/tuple

tuple

!!python/dict

dict

Complex Python tags

 

!!python/name:module.name

module.name

!!python/module:package.module

package.module

!!python/object:module.cls

module.cls

!!python/object/new:module.cls

module.cls

!!python/object/apply:module.f

value

 

 

你可能感兴趣的:(Python)