Python: Convert Binary String to Normal String


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
Regex find all matches in List Python Example

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

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

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