ucollections
– 容器¶
该模块实现相应CPython模块的子集,主要提供命名元组功能
- 使用示例
>>> import ucollections >>> >>> mytuple = ucollections.namedtuple('mytuple', ('id', 'name')) >>> t1 = mytuple(1, 'foo') >>> t2 = mytuple(3, 'bar') >>> >>> print(t1.id) 1 >>> print(t1.name) foo >>> print(t2.id) 3 >>> print(t2.name) bar >>>