Enumerations in Python | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Enumerations in Python

Is there a module to implement enumerations in python?

27th Nov 2017, 6:16 AM
Marcus Germano
3 ответов
+ 6
https://docs.python.org/3/library/enum.html from enum import Enum class States(Enum): WA = "Washington" OR = "Oregon" CA = "California" UT = "Utah" NY = "New York" print(States.WA.value)
27th Nov 2017, 6:35 AM
ChaoticDawg - avatar
+ 4
It's a built-in function, no library needed. https://docs.python.org/2/library/functions.html#enumerate
27th Nov 2017, 6:35 AM
+ 3
I guess it depends on which one you're asking about. Enumerate and enumerations are not the same thing, but you have an answer for either, so.... you should be good either way!
27th Nov 2017, 6:41 AM
ChaoticDawg - avatar