Encoding and Decoding Base64 Strings in Python

0
10KB

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)
Rechercher
Catégories
Lire la suite
Food
Best Foods for Weight Loss
Studies have shown that certain foods can affect appetite, so they may be beneficial for weight...
Par FWhoop Xelqua 2022-09-21 14:00:25 0 25KB
Television
Fox 8 Live TV. Cleveland, Texas, United States.
Fox 8 Cleveland (WJW), is a Fox-affiliated television station located in Cleveland, Texas, United...
Par Nikolai Pokryshkin 2022-10-24 09:18:43 0 28KB
Телевидение
Кубань 24 Прямая трансляция.
«Кубань 24» — единственный в Краснодарском крае телеканал, который осуществляет...
Par Nikolai Pokryshkin 2022-10-28 16:52:44 0 22KB
Multimedia
Multimedia
Multimedia - data, or content, which is presented simultaneously in different...
Par Michael Pokrovski 2024-03-27 19:19:59 0 24KB
Satire
Top 16 best TV series of 2022
Paradoxically, this terrible war year was very rich in good TV shows. I picked you eight of the...
Par FWhoop Xelqua 2023-01-02 17:51:46 0 21KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov