How do I write a program in PYHTON to accept a string and display it in binary?. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I write a program in PYHTON to accept a string and display it in binary?.

BINARY

28th Nov 2017, 3:19 PM
Vishwatma Bhat
3 Answers
0
I would do: str = "hello world" ' '.join (map(bin,bytearray(are, 'utf8'))) or use the binascii module like: import binascii bin (int (binascii.hexlify(st),16))
29th Nov 2017, 6:13 PM
Simon Chavez
Simon Chavez - avatar
0
thanks
12th Dec 2017, 10:51 AM
Vishwatma Bhat
0
Mr.simon, sir, I tried the same program which you sent but it doesn't seem to work
12th Dec 2017, 11:00 AM
Vishwatma Bhat