Skip to main content


Encoding and Decoding Base64 Strings in Python | Simple Formula

Encoding and Decoding Base64 Strings in Python

First Import Base64

>>> import base64

Encoding in Base64

>>> string = "test"
>>> 
>>> base64_string = base64.b64encode(f'{string}'.encode("ascii")).decode("ascii")
>>> base64_string
'dGVzdA=='

Decoding in Base64

>>> base64_decoded = base64.b64decode(f'{base64_string}'.encode("ascii")).decode('ascii')
>>> base64_decoded
'test'

Comments



🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍

Popular Posts

Python underline string, Python underline text, Underline python print

Python pip - Installing modules from IDLE (Pyton GUI) for python 3.7

Top 40 Python - String Processing in Python | Working with String in Python

Top 11 Essential Python Tips and Tricks

Python Program - When was I born? / Date of Birth / MY BIRTHDAY (using Python3+)





Subscribe to our Channel


Follow us on Facebook Page

Join our python facebook groups



Join us on Telegram