Skip to content

Instantly share code, notes, and snippets.

@shau-lok
Created May 2, 2017 03:56
Show Gist options
  • Save shau-lok/bc9440462d142ee602f3f0b76b2840c0 to your computer and use it in GitHub Desktop.
Save shau-lok/bc9440462d142ee602f3f0b76b2840c0 to your computer and use it in GitHub Desktop.
python byte to string
# 将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