Python enum multiple values 枚举多个值
转载自:https://tutorial.eyehunts.com/python/python-enum-multiple-values-example-code/
Use MultiValueEnum to get enum multiple values in Python. You have to install and import aenum library and this is the easiest way.
# Python enum with multiple values example
from aenum import MultiValueEnum
class DType(MultiValueEnum):
float32 = "f", 8
double64 = "d", 9
print(DType("f"))
print(DType(9))