Encoding and Decoding Base64 Strings in Python

0
13χλμ.

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)
Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Aviation
Aviation: Soaring Through History
Introduction Aviation, the art and science of flight, has captivated humanity for centuries....
από Dacey Rankins 2024-10-07 17:07:31 0 19χλμ.
Personal Finance
How Do I Ask for a Raise? A Practical, Confident Guide
How Do I Ask for a Raise? A Practical, Confident Guide Asking for a raise is one of the most...
από Leonard Pokrovski 2025-11-28 21:08:54 0 2χλμ.
Africa
How Do they celebrate the new years in Africa?
Connection between the calendar and natural phenomena, new Year's rituals of Africans and the...
από FWhoop Xelqua 2022-12-30 15:18:01 0 23χλμ.
Социальные проблемы
Бешеные псы. Reservoir Dogs. (1992)
Это должно было стать идеальным преступлением. Задумав ограбить ювелирный магазин, криминальный...
από Nikolai Pokryshkin 2023-01-11 17:57:32 0 30χλμ.
Life Issues
Mary and Max. (2009)
A tale of friendship between two unlikely pen pals: Mary, a lonely, eight-year-old girl living in...
από Leonard Pokrovski 2023-04-07 20:47:17 0 29χλμ.

BigMoney.VIP Powered by Hosting Pokrov