How to obtain the binary representation of an integer in Python

With Python 2.6+, that's quite simple:

print "{0:b}".format(i)

Example:

>>> print "{0:b}".format(17)
10001
>>> print "{0:b}".format(224)
11100000

See the Python documentation for more info about string formatters: http://docs.python.org/library/string.html#string-formatting