mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-23 20:11:13 +00:00
namedtuple example
This commit is contained in:
parent
660ffd0a72
commit
b792f8b03e
5
howtos_as_py_files/namedtuple_example.py
Normal file
5
howtos_as_py_files/namedtuple_example.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
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)
|
Loading…
Reference in New Issue
Block a user