Created
July 29, 2020 20:27
-
-
Save hash3liZer/ebdacd05cbf39ece7ea826062c304a21 to your computer and use it in GitHub Desktop.
Python 3 Bytes Vs Strings
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
# String Encoding to Bytes | |
aa = "a value here" | |
aa = aa.encode('utf-8') | |
# Bytes Conversion to String | |
bb = b"these are bytes" | |
bb = bb.decode('utf-8') | |
print(type(aa)) | |
print(type(bb)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment