-1

I want a easy form to define multiple constant and enumerate them, so that using only the name of every constant give me the value of the enumeration, similar to enum in C but in Python 3. For example:

harmonic=0
vrms=1
irms=2
.
.
.
and so

juliancaba
  • 47
  • 2
  • mmm https://docs.python.org/3/library/enum.html – eyllanesc Dec 22 '19 at 01:02
  • Hi @juliancaba, welcome to stackoverflow! Please try to be a bit more precise with your questions, this will help everybody in the end and also make it much more likely, that your questions get answered. Best wishes, Andreas – Andreas Dec 22 '19 at 01:10

1 Answers1

0
>>> from enum import Enum
>>> class mycons(Enum):
...  vrms=1
...  irms=2
...  

>>> print(mycons.irms.name)
irms
>>> print(mycons.irms.value)
2
Salim
  • 2,046
  • 12
  • 13