用class语法派生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
   
print('\nMember name: {}'.format(BugStatus.wont_fix.name))
print('Member name: {}'.format(BugStatus.wont_fix.value))
 
 
posted @ 2019-10-14 16:09  zhouhaiwu  阅读(316)  评论(0编辑  收藏  举报