
In order to do base64 encoding and decoding in Python Programming, make use of the base64 package,
Code Example:"""
Base 64 Encoding Decoding in
Python Programming
Author: Code2care.org
Date: 03-Apr-2022
Version: 1.0
"""
import base64
plan_text_string = 'Hello there! Python'
# Base64 Encode Example
base64_encoded_string_result = base64.b64encode(plan_text_string.encode('utf-8'))
print(base64_encoded_string_result)
# Base64 Decode Code
base64_encoded_string = 'SGVsbG8gdGhlcmUhIFB5dGhvbg=='
base64_decoded_string_result = base64.b64decode(base64_encoded_string).decode('utf-8')
print(base64_decoded_string_result)
Output:
b'SGVsbG8gdGhlcmUhIFB5dGhvbg=='
Hello there! Python
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!