From b792f8b03ed0549cc36926722994cddde2572f32 Mon Sep 17 00:00:00 2001 From: rasbt Date: Thu, 26 Jun 2014 17:54:14 -0400 Subject: [PATCH] namedtuple example --- howtos_as_py_files/namedtuple_example.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 howtos_as_py_files/namedtuple_example.py diff --git a/howtos_as_py_files/namedtuple_example.py b/howtos_as_py_files/namedtuple_example.py new file mode 100644 index 0000000..0546d85 --- /dev/null +++ b/howtos_as_py_files/namedtuple_example.py @@ -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)