0

The following class declares variables and their values.

class StaticTileType(Enum):
    CHASM = 0
    EMPTY = 1
    GRASS = 2
    EMPTY_WELL = 3
    WALL = 4
    DOOR = 5

print(StaticTileType(4))

This code prints StaticTileType.DOOR. How can I print/return DOOR only, without the module name?

2 Answers 2

2

The name attribute of the Enum

print(StaticTileType(4).name)

Result:

WALL
Sign up to request clarification or add additional context in comments.

Comments

1

You may need to create object of that class and access values

obj= StaticTileType(4)

print(obj.DOOR)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.