python namedtuple命名元组
from collections import namedtuple Animal=namedtuple('Animal','name age type') perry=Animal(name='perry',age=1,type='cat') print(perry.type) print(perry[0]) print(perry._asdict())
每天扫一扫,到店付款省钱!
动动小手支持一下作者,谢谢🙏
from collections import namedtuple Animal=namedtuple('Animal','name age type') perry=Animal(name='perry',age=1,type='cat') print(perry.type) print(perry[0]) print(perry._asdict())
动动小手支持一下作者,谢谢🙏