I know this is easily possible in python 2.6. But what is the easiest way to do this in Python 2.5?
x = \"This is my string\"
b = to_bytes(x) # I could d
I think you could do it in a cleaner way like this:
>>>''.join(format(ord(c), '08b') for c in 'This is my string')
'0101010001101000011010010111001100100000011010010111001100100000011011010111100100100000011100110111010001110010011010010110111001100111'
the format function will represent the character in a 8 digits, binary representation.