Linked Questions

52 questions linked to/from Convert binary to ASCII and vice versa
8 votes
3 answers
36k views

I've made a little python program that reads binary from a file and stores it to a text file, read the text file and store the binary. But, I can't get the binary to work... it reads the files like ...
3 votes
1 answer
10k views

x = "01100001" How do i convert this string into ASCII Expected Result: print(x.somefunction()) Output: a
3 votes
4 answers
5k views

I have a numpy binary array like this: np_bin_array = [0 1 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] It was 8-bit ...
pds360's user avatar
  • 31
-4 votes
2 answers
297 views

Using python, I want to convert/interpret a string made of 0 and 1 as if it was binary. Assume I have a string that looks like this: >>>str = "...
Mikalo's user avatar
  • 1
0 votes
0 answers
454 views

i was trying to make ascii from binary. but i got error 'utf-8' codec can't decode byte 0xa6 in position 1: invalid start byte here's my code, please help me def stringmodulasi(f): f = "...
0 votes
2 answers
113 views

So i have a function that converts an alphabet character to it's binary. def toBinary(char): return "".join([format(ord(char), '#010b')[2:]]) For example, toBinary('a') gives me 01100001 How do ...
Maxxx's user avatar
  • 3,798
0 votes
0 answers
46 views

So firstly I have two lists : l1 = [chr(x) for x in range(32,160)] l2 = [bin(x)[2:].rjust(7,'0') for x in range(128)] The first one list 128 characters, and the second 128 binary values (7 bits so ...
John Doe's user avatar
184 votes
10 answers
655k views

I am in need of a way to get the binary representation of a string in python. e.g. st = "hello world" toBinary(st) Is there a module of some neat way of doing this?
26 votes
11 answers
94k views

I need to convert an ASCII string into a list of bits and vice versa: str = "Hi" -> [0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1] [0,1,0,0,1,0,0,0,0,1,1,0,1,0,0,1] -> "Hi"
Dan's user avatar
  • 1,546
18 votes
3 answers
87k views

Despite the many related questions, I can't find any that match my problem. I'd like to change a binary string (for example, "0110100001101001") into a byte array (same example, b"hi"). I tried this:...
Numeri's user avatar
  • 1,057
12 votes
7 answers
41k views

I have a hex value in a string like h = '00112233aabbccddee' I know I can convert this to binary with: h = bin(int(h, 16))[2:] However, this loses the leading 0's. Is there anyway to do this ...
root's user avatar
  • 705
19 votes
6 answers
116k views

I have searched many times online and I have not been able to find a way to convert my binary string variable, X X = "1000100100010110001101000001101010110011001010100" into a UTF-8 string value. I ...
10 votes
5 answers
17k views

Is there an easy way to get some str/unicode object represented as a big binary number (or an hex one)? I've been reading some answers to related questions but none of them works for my scenario. I ...
10 votes
2 answers
55k views

I want to read the raw binary of a file and put it into a string. Currently I am opening a file with the "rb" flag and printing the byte but it's coming up as ASCII characters (for text that is, for ...
8 votes
3 answers
29k views

I am trying to convert a bit string into a byte string, in Python 3.x. In each byte, bits are filled from high order to low order. The last byte is filled with zeros if necessary. The bit string is ...
user avatar

15 30 50 per page
1
2 3 4