
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to use enums in Python classes?
There is a module name "enum" in python with the hep of which enum is used in python.
#import enum import enum # use enum in class class Car(enum.Enum): suzuki = 1 Hyundai = 2 Dezire = 3 print ("All the enum values are : ") for c in (Car): print(c)
- Related Articles
- How to use enums in C++?
- How to use enums in C/C++?
- How to list all the classes, interfaces, and enums in JShell in Java 9?
- Java Program to use == operator to compare enums
- How do we use equivalence (“equality”) operator in Python classes?
- How to define classes in Python?
- How to use classes in other package in Java
- How to map C++ enums to strings?
- How do we use different CSS classes in HTML?
- How data hiding works in Python Classes?
- How to organize Python classes in modules and/or packages
- Enums in Rust Programing
- Creating Classes in Python
- Introduction to Classes and Inheritance in Python
- Data Classes in Python (dataclasses)

Advertisements