Articles → Python → Encode and decode function of bytes in python

Encode and decode function of bytes in python






Purpose





Example


str_original = 'Hello'

# Encoding
bytes_encoded = str_original.encode()
print("Encoding:", bytes_encoded)


# Decoding
str_original = bytes_encoded.decode()
print("Decoding:", str_original)



Output



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, May 03, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250