Encoding and Decoding Base64 Strings in Python

0
15Кб

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)
Поиск
Категории
Больше
Personal Development
What are personal development quotes?
What Are Personal Development Quotes? Personal development quotes are short, powerful statements...
От Michael Pokrovski 2026-02-12 14:48:46 0 6Кб
Decision Making and Problem Solving
Best vitamins for memory
The mind is not a warehouse, and it is certainly not a hard drive. We operate under the...
От Michael Pokrovski 2026-07-17 01:05:36 0 2Кб
Customer Service
What Is Customer Service Software?
In today’s fast-paced and highly competitive business environment, delivering exceptional...
От Dacey Rankins 2026-03-11 22:28:04 0 7Кб
Научная фантастика и фэнтези
Назад в будущее. Back to the Future. (1985)
Подросток Марти с помощью машины времени, сооружённой его другом-профессором доком Брауном,...
От Nikolai Pokryshkin 2022-11-23 16:35:23 0 35Кб
Социальные проблемы
Крестный отец 2. The Godfather Part II. (1974)
Для дона Корлеоне и его сына не существует моральных преград на пути к достижению целей. Они...
От Nikolai Pokryshkin 2022-10-29 21:00:07 0 46Кб

BigMoney.VIP Powered by Hosting Pokrov