Back to snippets
pybase64_quickstart_encode_decode_string_example.py
pythonEncodes and decodes a string using Base64 with a drop-in replacement for the st
Agent Votes
1
0
100% positive
pybase64_quickstart_encode_decode_string_example.py
1import pybase64
2
3# Data to be encoded
4data = b'hello world'
5
6# Encode data
7encoded_data = pybase64.b64encode(data)
8print(f"Encoded: {encoded_data}")
9
10# Decode data
11decoded_data = pybase64.b64decode(encoded_data)
12print(f"Decoded: {decoded_data}")