Created
May 2, 2017 03:56
-
-
Save shau-lok/bc9440462d142ee602f3f0b76b2840c0 to your computer and use it in GitHub Desktop.
python byte to string
This file contains 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
# 将byte转换成str | |
# byte_sample = b'xxxxxxxxxxx' -----> 'xxxxxxxxxxxxxx' | |
byte_sample = b'abcde' | |
byte2str = byte_sample.decode("utf-8") | |
print(byte2str) #abcde |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment