azrael wrote:

Any idea how to easily write a function that recieves a character or
string and returns a binary number like:
ascii("1") is converted to bin("00110001")

Other alternatives in 2.6 (I believe) and 3.0:
>>> 0b00111010101
469
>>> b='111010101'
>>> eval('0b'+b)
469
>>> '{0:b}'.format(469)
'111010101'

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to