python开发中有时候需要遍历某对象的属性list:
class Person(object):
"""
职员信息
"""
name = 0
age = 1
id = 2
group = 3
attr = [a for a in dir(Person) if not a.startswith('__')]
for a in attr:
print(a, getattr(Person, a))
"""
age 1
group 3
id 2
name 0
"""