1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to convert an int to a hex string?

Discussão em 'Python' iniciado por Stack, Outubro 1, 2024 às 12:42.

  1. Stack

    Stack Membro Participativo

    I want to take an integer (that will be <= 255), to a hex string representation

    e.g.: I want to pass in 65 and get out '\x41', or 255 and get '\xff'.

    I've tried doing this with the struct.pack('c',65), but that chokes on anything above 9 since it wants to take in a single character string.

    Continue reading...

Compartilhe esta Página