I'm using the answer i saw here.
My function is
def to_bin(s):
return ' '.join(format(x, 'b') for x in bytearray(s))
It was working really well until i tried to convert a '%' character, i get the output :
>>>to_bin('%')
'100101'
while my expected result is :
>>>to_bin('%')
'0100101'
Do any of you have a solution ?
Thanks in advance.