[Python] How to decode a text in python3?

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

  1. Stack

    Stack Membro Participativo

    I have a text Aur\xc3\xa9lien and want to decode it with python 3.8.

    I tried the following

    import codecs
    s = "Aur\xc3\xa9lien"
    codecs.decode(s, "urf-8")
    codecs.decode(bytes(s), "urf-8")
    codecs.decode(bytes(s, "utf-8"), "utf-8")


    but none of them gives the correct result Aurélien.

    How to do it correctly?

    And is there no basic, general authoritative simple page that describes all these encodings for python?

    Continue reading...

Compartilhe esta Página