📜  命名元组 python 迭代 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:51.458000             🧑  作者: Mango

代码示例1
>>> a = A(1, 2)
>>> for name, value in a._asdict().iteritems():
    print name
    print value


a
1
b
2

>>> for fld in a._fields:
    print fld
    print getattr(a, fld)


a
1
b
2