Contact: aviboots(AT)netvision.net.il
41,397 questions
53,943 answers
573 users
import collections Worker = collections.namedtuple("Worker", ["id", "name", "salary"]) values = [123, "tom", 13874] tpl = Worker._make(values) print(tpl) ''' run: Worker(id=123, name='tom', salary=13874) '''
import collections Worker = collections.namedtuple("Worker", ["id", "name", "salary"]) values = [123, "tom", 13874] tpl = Worker._make(values) print(tpl.id) print(tpl.name) print(tpl.salary) ''' run: 123 tom 13874 '''