Created
June 2, 2023 16:53
-
-
Save moulik-source/a6429a46201c822f456e2e441b3ed0f6 to your computer and use it in GitHub Desktop.
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
my_byte = b'Hello' | |
my_string = my_byte.decode('utf-8') # converts bytes to a string using UTF-8 encoding | |
print(my_string) # 'Hello' | |
new_byte = my_string.encode('utf-8') # converts the string back to bytes using UTF-8 encoding | |
print(new_byte) # b'Hello' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment