from enum import Enum # pip install enum34 class Build(Enum): debug = 200 build = 400 string to enum a=Build['debug'] output: '400' enum to string a.name output: 'debug' .int to enum b=Build(400) enum to int b.value