Python

How to Encode & Decode using Base64 in Python?

How to Encode & Decode using Base64 in Python?, someone asked me to explain?
In this video I will show you how to encode and decode using Base64 in Python.
CODE:
import base64
my_string = "This is my text document.."
encoded_str = base64.b64encode(my_string.encode('ascii'))
print(f"Encoded string: { encoded_str }")
mystr_decoded = base64.b64decode(encoded_str.decode('ascii'))
print(f"Decoded string: { mystr_decoded }")

Output:

Encode Decode in python

Post your comments / questions