>>> "Hello". Encode ("hex")
' 68656c6c6f '
The corresponding can also
>>> ' 68656c6c6f '. Decode ("hex")
' Hello '
Check the manuals, and these codec are available.
Codec |
Aliases |
Operand type |
Purpose |
| Base64_codec |
Base64, base-64 |
byte string |
Convert operand to MIME base64 |
| Bz2_codec |
bz2 |
byte string |
Compress the operand using bz2 |
| Hex_codec |
Hex |
byte string |
Convert operand to hexadecimal representation, with both digits per byte |
| Idna |
|
Unicode string |
Implements RFC 3490. New in version 2.3. See also Encodings.idna |
| Mbcs |
Dbcs |
Unicode string |
Windows Only:encode operand According to the ANSI codepage (CP_ACP) |
| PalmOS |
|
Unicode string |
Encoding of PalmOS 3.5 |
| Punycode |
|
Unicode string |
Implements RFC 3492. New in version 2.3. |
| Quopri_codec |
Quopri, Quoted-printable, quotedprintable |
byte string |
Convert operand to MIME quoted printable |
| Raw_unicode_escape |
|
Unicode string |
Produce a string that's suitable as raw Unicode literal in Python source code |
| Rot_13 |
Rot13 |
Unicode string |
Returns the Caesar-cypher encryption of the operand |
| String_escape |
|
byte string |
Produce a string that's suitable as string literal in Python source code |
| Undefined |
|
Any |
Raise an exception for all conversions. Can be used as the system encoding if no automatic coercion between byte and Unicode strings is desired. |
| Unicode_escape |
|
Unicode string |
Produce a string that's suitable as Unicode literal in Python source code |
| Unicode_internal |
|
Unicode string |
Return the internal representation of the operand |
| Uu_codec |
Uu |
byte string |
Convert the operand using uuencode |
| Zlib_codec |
Zip, zlib |
byte string |
Compress the operand using gzip |