[Python] Enumeration with auto-numbering starting at 0

Discussão em 'Python' iniciado por Stack, Julho 26, 2025.

  1. Stack

    Stack Membro Participativo

    Is there a better way to create a long list of enumeration with auto-numbering starting at 0? The closest that I can find is:

    class Color(Enum):
    red, green, blue=range(3)


    However, the above approach requires knowing the total items in the enumeration beforehand.

    Continue reading...

Compartilhe esta Página