python_reference/howtos_as_py_files/namedtuple_example.py
2014-06-26 17:54:14 -04:00

6 lines
163 B
Python

from collections import namedtuple
my_namedtuple = namedtuple('field_name', ['x', 'y', 'z', 'bla', 'blub'])
p = my_namedtuple(1, 2, 3, 4, 5)
print(p.x, p.y, p.z)