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