迭代处理enum类会生成枚举的各个成员

import enum
class BugStatus(enum.Enum):
   
    new = 7
    incomplete = 6
    invalid = 5
    wont_fix = 4
    in_progress = 3
    fix_committed = 2
    fix_released = 1
   
for status in BugStatus:
    print('{:15} = {}'.format(status.name, status.value))
--------------------------------------------------------------------
 
new             = 7
incomplete      = 6
invalid         = 5
wont_fix        = 4
in_progress     = 3
fix_committed   = 2
fix_released    = 1
posted @ 2019-10-14 16:12  zhouhaiwu  阅读(383)  评论(0编辑  收藏  举报