Python namedtuple的使用
namedtuple: factory function for creating tuple subclasses with named fields.
from collections import namedtuple
代码示例
Point = namedtuple('Point', 'x y', verbose=True)
point = Point(1,2)
print point.x,point.y
namedtuple: factory function for creating tuple subclasses with named fields.
from collections import namedtuple
代码示例
Point = namedtuple('Point', 'x y', verbose=True)
point = Point(1,2)
print point.x,point.y