Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

string to bits python

str = "cde"

str_as_byte_array = bytearray(str, "utf8") 
bytes_arr = []

for byte in str_as_byte_array:
	binary_representation = bin(byte)
	bytes_arr.append(binary_representation)

print(bytes_arr)  # ['0b1100011', '0b1100100', '0b1100101']
 
PREVIOUS NEXT
Tagged: #string #bits #python
ADD COMMENT
Topic
Name
7+4 =