Answers for "char to binary python"

3

char to binary python

>>> st = "hello world"
>>> ' '.join(format(ord(x), 'b') for x in st)
'1101000 1100101 1101100 1101100 1101111 100000 1110111 1101111 1110010 1101100 1100100'

#using `bytearray`
>>> ' '.join(format(x, 'b') for x in bytearray(st, 'utf-8'))
'1101000 1100101 1101100 1101100 1101111 100000 1110111 1101111 1110010 1101100 1100100'
Posted by: Guest on May-30-2020
0

binary to int javascript

let binary = 0001
parseInt(binary, 2)
// returns 1
Posted by: Guest on April-27-2020

Python Answers by Framework

Browse Popular Code Answers by Language