0
How can I implement enum in python 3.7 version?
6 Réponses
0
from enum import Enum
class Color(Enum):
red = 1
green = 2
blue = 3
print(Color.red)
0
from enum import Enum
class Color(Enum):
red = 1
green = 2
blue = 3
print(Color.red)
It shows error like this
name 'Color' is not defined
0
Can you execute the following and share the output, to get more info about your Version?
import sys
print(sys.version)
print(sys.version_info)
0
3.7.4 version Actually I tried all ides of python but I didn't got the output of enum
- 1
color inherited from the Enum class so instantiate it
color = Color()
print(color.red)
If we use this it shows an error like expected an indented block