Encoding and Decoding Base64 Strings in Python
نشر بتاريخ 2023-03-10 20:59:12
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
)
البحث
الأقسام
- Arts
- Business
- Computers
- الألعاب
- Health
- الرئيسية
- Kids and Teens
- مال
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
إقرأ المزيد
Последний Парадизо. The Last Paradiso. (2021)
Италия, 1950-е.Свободолюбивый фермер борется за лучшие условия труда.Он мечтает о любви,...
LG launches Native Screensaver Ads. What is it?
The American company LG Ad Solutions, a division of the South Korean giant - the manufacturer of...
Sushi
Sushi, or sushi (Jap. すし, 寿司, 壽司, 鮨, 鮓, 寿斗, 寿し sushi, [sɯɕi]; Indeclinable), is a dish of...
Types of Computers
Types of Computers
Computers are distinguished by a variety of criteria, which are related to...
What Legal Structures Are Suitable for a Social Enterprise?
Choosing the right legal structure is a critical decision for any social enterprise. Unlike...