Pythonの冷たい知識の命名メタグループ


  tuple: Python              
    :namedtuples: python           
              (index)   
    :                 ,(  .  )
  :
   from collection import namedtuple
  :
In [11]: Car  = namedtuple('Car', 'color size mileage')
In [12]: mycar = Car('red','BMW','1000')
In [13]: mycar.color
Out[13]: 'red'
In [14]: mycar.size
Out[14]: 'BMW'
In [15]: mycar.mileage
Out[15]: '1000'
In [16]: