python_reference/howtos_as_py_files/namedtuple_example.py

6 lines
163 B
Python
Raw Normal View History

2014-06-26 21:54:14 +00:00
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)