[Python] What are variables generated as "_1", "_2", "_3"... "_1i"...."_" when printing dir()?

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am running Python with IPython. Out of nowhere the following variables are being created when I print dir().

    Here are some of the variables with following code:

    for i in dir():
    if "_" in i:
    print(i)

    # Output:
    _
    _12
    _13
    _14
    _15
    _19
    __
    ___

    _i
    _i1
    _i10
    _i11
    _i2
    _i3
    _i4
    _i5
    _i6
    _i7
    _i8
    _i9
    _ih
    _ii
    _iii
    _oh

    Continue reading...

Compartilhe esta Página