Answers for "from binary to text python"

1

binary to text python

a_binary_string = "01100001 01100010 01100011"
ascii_string = "".join([chr(int(binary, 2)) for binary in a_binary_string.split(" ")])
# ascii_string = "abc"
Posted by: Guest on April-20-2021
0

text to binary python

a_string = "abc"

a_byte_array = bytearray(a_string, "utf8")

byte_list = []

for byte in a_byte_array:

    binary_representation = bin(byte)
    byte_list.append(binary_representation)

print(byte_list)

#Output ['0b1100001', '0b1100010', '0b1100011']
Posted by: Guest on October-28-2021

Code answers related to "from binary to text python"

Python Answers by Framework

Browse Popular Code Answers by Language