Created
July 19, 2017 14:11
-
-
Save nuryslyrt/64ce0950b2afd6c2035a5ea8d76b0e89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In Python 3 you can't call encode() on 8-bit strings anymore, so the hex codec became pointless and was removed. | |
| Although you theoretically could have a hex codec and use it like this: | |
| >>> import codecs | |
| >>> hexlify = codecs.getencoder('hex') | |
| >>> hexlify(b'Blaah')[0] | |
| b'426c616168' | |
| Using binascii is easier and nicer: | |
| >>> import binascii | |
| >>> binascii.hexlify(b'Blaah') | |
| b'426c616168' | |
| Also the hex codec has been chucked in 3.x. I'm using binascii instead |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment