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:softpython36python.exe D:/myproject/demo/log/test.py Tomsom 12 Cooker