Encoding and Decoding Base64 Strings in Python

0
10كيلو بايت

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)
البحث
الأقسام
إقرأ المزيد
Hand Games
16 of the best games of our childhood that we lost
In the XXI century, children quietly disappeared from the courtyards of large cities - now they...
بواسطة FWhoop Xelqua 2022-11-14 10:59:43 0 28كيلو بايت
Business
Why Are Salaries So High in Silicon Valley?
Silicon Valley, home to tech giants like Google, Apple, and Meta, is known not only for...
بواسطة Dacey Rankins 2025-04-28 16:05:27 0 4كيلو بايت
Animation
Top Five Kids Cartoons
Kipo and the Age of WonderbeastsThis fantastical anime-style Netflix series follows Kipo Oak, a...
بواسطة FWhoop Xelqua 2023-04-29 19:58:00 0 21كيلو بايت
Ужасы
Дальний космос. Stowaway (2021)
Экипаж космического корабля, направляющегося на Марс, обнаруживает на борту случайного пассажира...
بواسطة Nikolai Pokryshkin 2022-09-18 22:13:39 0 58كيلو بايت
Automotive
Auto Mobile Businesses
How do they make money in the auto business?When you are a motorist, it may seem to you that...
بواسطة FWhoop Xelqua 2023-07-20 17:09:41 0 23كيلو بايت
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov