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


Picture showing the output of Encode and decode function of bytes in python



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

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250