Encoding and Decoding Base64 Strings in Python

0
10K

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)
Site içinde arama yapın
Kategoriler
Read More
Business
What Is the CEO's Background and Experience?
When evaluating a startup, one of the first areas of focus for potential investors, employees,...
By Dacey Rankins 2025-05-02 15:06:42 0 4K
Television
8XM Live TV. Pakistan.
8XM is a Pakistani music television channel, on air since July 2011. 8XM airs all types of music,...
By Nikolai Pokryshkin 2022-11-26 19:01:37 0 36K
Social Issues
A Christmas Gift from Bob (2020)
A struggling street musician finds himself the target of an animal welfare investigation that...
By Leonard Pokrovski 2022-10-07 22:30:32 0 24K
Искусство, культура и развлечения
Ма Рейни. Мать Блюза. Ma Rainey's Black Bottom. (2020)
1927 год. Легендарная исполнительница блюза Ма Рейни вместе с группой прибывает в Чикаго для...
By Nikolai Pokryshkin 2022-09-24 20:20:18 0 29K
Business
How Often Should I Update My Business Biography?
A business biography serves as a personal and professional narrative that highlights the key...
By Dacey Rankins 2025-01-06 15:55:28 0 7K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov