1. namedtuple
tuple是immutable的,初始化後值就無法改變
namedtuple適用於想存一個不希望有人改值的資料時
>>> from collections import namedtuple
>>> Student = namedtuple('Student', ['name', 'age'])
>>> a = Student('Tom', 20)
>>> a.name
'Tom'
>>> a.age
20
>>> a.age=21
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: can't set attribute