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)
Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Business
What is the Best Business Planning Software?
When it comes to starting a new business or refining an existing one, creating a comprehensive...
από Dacey Rankins 2024-12-19 15:04:14 0 11χλμ.
Programming
Python Regex
A RegEx, or Regular Expression, is a sequence of characters that forms a search...
από Jesse Thomas 2023-04-05 19:02:13 0 9χλμ.
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χλμ.
Искусство, культура и развлечения
Ма Рейни. Мать Блюза. Ma Rainey's Black Bottom. (2020)
1927 год. Легендарная исполнительница блюза Ма Рейни вместе с группой прибывает в Чикаго для...
από Nikolai Pokryshkin 2022-09-24 20:20:18 0 29χλμ.
Television
FOX 13 News. Live TV Tampa Bay, USA.
Tampa Bay area news, weather, radar, sports, traffic, live newscasts, and more. From WTVT-TV FOX...
από Nikolai Pokryshkin 2022-09-25 10:26:43 0 43χλμ.

BigMoney.VIP Powered by Hosting Pokrov