[Python] Python 'list' automatically converting hex value into decimal

Discussão em 'Python' iniciado por Stack, Fevereiro 6, 2025.

  1. Stack

    Stack Membro Participativo

    I have recently started learning Python and have so much confusion,

    I have two input bytearrays,

    x = bytearray(b'\xac\xe0\x1f\x15n\x99\xf1\xce\xba\xba\x8d\x9a\xda-JG')
    y = bytearray(b'\x9d\x93\xcd\x0f(\xa8\xd6\xa9\xea\x10\x8d_\xbd7\xc6Y')


    When I print them,

    print(x)
    print(y)


    it gives exactly the same output.

    I now want to zip these two variables,x and y.

    Since we use list to see the content of zip in Python 3,

    I used the following code,

    print( list(zip(x,y)) )


    and here is the output,

    [(172, 157), (224, 147), (31, 205), (21, 15), (110, 40), (153, 168), (241, 214),
    (206, 169), (186, 234), (186, 16), (141, 141), (154, 95), (218, 189), (45, 55),
    (74, 198), (71, 89)]


    I don't understand Why it is converted to Decimal values ?

    Continue reading...

Compartilhe esta Página