Title: Using Named Tuples To Store Data
Slug: using_named_tuples_to_store_data
Summary: Using Named Tuples To Store Data in Python.
Date: 2016-01-23 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
Interesting in learning more? Check out Fluent Python
In [1]:
from collections import namedtuple
In [2]:
Vehicle = namedtuple('Vehicle', 'make model wheels manual')
In [3]:
forrester = Vehicle('Forrester', 'Subaru', 4, True)
In [4]:
forrester.model
Out[4]:
In [5]:
forrester.wheels
Out[5]: