+ 1

How to code sentence to binary, using Python.

I want to tell my friend that is a beautiful, intelligent woman in binary. From English to binary, preferably in Python. For Valentines Day.

30th Jan 2019, 5:23 PM
joseph
joseph - avatar
3 Réponses
+ 4
print(' '.join([(bin(ord(c))[2:]).zfill(8) for c in 'Your text here']))
30th Jan 2019, 6:00 PM
Anna
Anna - avatar
+ 3
Anna Shorter version: print(*(bin(ord(c))[2:].zfill(8) for c in "Your text here"))
30th Jan 2019, 8:24 PM
Diego
Diego - avatar
+ 1
thank you! anna, diego.
30th Jan 2019, 8:37 PM
joseph
joseph - avatar