python-namedtuple命名元组
from collections import namedtuple MyTupleClass = namedtuple('MyTupleClass',['name', 'age', 'job']) obj = MyTupleClass("Tomsom",12,'Cooker') print(obj.name) print(obj.age) print(obj.job)
output:
D:\soft\python36\python.exe D:/myproject/demo/log/test.py Tomsom 12 Cooker
踩坑是成长最快的方式