Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ccd6739

Browse files
Create Using enum module
1 parent 2820b6e commit ccd6739

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎Using enum module‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from enum import Enum
2+
3+
class Day(Enum):
4+
MONDAY = 1
5+
TUESDAY = 2
6+
WEDNESDAY = 3
7+
8+
# print the enum member
9+
print(Day.MONDAY)
10+
11+
# get the name of the enum member
12+
print(Day.MONDAY.name)
13+
14+
# get the value of the enum member
15+
print(Day.MONDAY.value)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /