Encoding and Decoding Base64 Strings in Python

0
13KB

The Base64 encoding is used to convert bytes that have binary or text data into ASCII characters. Encoding prevents the data from getting corrupted when it is transferred or processed through a text-only system. In this article, we will discuss about Base64 encoding and decoding and its uses to encode and decode binary and text data. Each Base64 character represents 6 bits of data. it is also important to note that it is not meant for encryption for obvious reasons.

 

import base64
  
sample_string = "Hello world!"
sample_string_bytes = sample_string.encode("ascii")
  
base64_bytes = base64.b64encode(sample_string_bytes)
base64_string = base64_bytes.decode("ascii")
  
print(base64_string)
Suche
Kategorien
Mehr lesen
История
Монти Пайтон и священный Грааль. Monty Python and the Holy Grail. (1975)
Король Артур и рыцари Круглого стола отправляются в невероятное путешествие на поиски Святого...
Von Nikolai Pokryshkin 2023-02-20 12:30:09 0 26KB
Marketing and Advertising
How Do I Tell a Good Story? The Key Elements of Powerful Storytelling in Marketing
In the world of marketing, information alone doesn’t move people — stories do. Data...
Von Dacey Rankins 2025-11-04 17:31:43 0 811
Biology
Biology
Biology (Greek: βιολογία; from Ancient Greek:...
Von FWhoop Xelqua 2023-03-03 16:42:32 0 21KB
Geld
What affects my credit rating?
What affects my credit rating? A credit rating is one of the most important financial markers...
Von Leonard Pokrovski 2025-09-28 21:41:51 0 3KB
Television
FOX 10 Live TV from Phoenix USA
Raw & unfiltered. Watch a non-stop stream of breaking news, live events and stories across...
Von Nikolai Pokryshkin 2022-09-08 09:14:15 0 47KB

BigMoney.VIP Powered by Hosting Pokrov