Python: Convert Binary String to Normal String


Example:

binary_string = "010000110110111101100100011001010011001001100011011000010111001001100101"

# Step 1: Split the binary string into chunks of 8 characters
binary_chunks = [binary_string[i:i+8] for i in range(0, len(binary_string), 8)]

# Step 2: Convert to ASCII Character
ascii_characters = [chr(int(chunk, 2)) for chunk in binary_chunks]

# Step 3: Join to form a Normal String
normal_string = ''.join(ascii_characters)

# Result
print(normal_string)
Regex find all matches in List Python Example
-

Facing issues? Have Questions? Post them here! I am happy to answer!


Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap