Encoding and Decoding Base64 Strings in Python

0
7KB

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)
Search
Nach Verein filtern
Read More
Life Issues
Wicked Minds. (2003)
A young man returns home from college to find his father remarried, until the sudden murder of...
Von Leonard Pokrovski 2023-05-04 18:28:23 0 20KB
Graphic Design
The Art and Impact of Graphic Design: Shaping Visual Communication
Graphic design is a powerful tool that shapes how we perceive and interact with the world...
Von Dacey Rankins 2024-12-03 15:37:48 0 3KB
Gardening
The Joy of Home Gardening: Cultivating Your Green Thumb
Home gardening has gained immense popularity in recent years, and for good reason. Whether you...
Von Dacey Rankins 2024-10-09 17:39:16 0 12KB
Ausbildung
Painting Schools
We are often approached by students who want to study fine arts and subsequently find a...
Von FWhoop Xelqua 2023-06-26 17:13:34 0 18KB
Социальные проблемы
Охотник на оленей. The Deer Hunter. (1978)
История о трех американцах русского происхождения - их жизни до, во время и после войны во...
Von Nikolai Pokryshkin 2023-03-30 09:58:29 0 17KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov