binary representaion of a number

Neil Schemenauer nascheme at enme.ucalgary.ca
Mon Aug 21 20:37:01 EDT 2000


David Broadwell <dbroadwell at mindspring.com> wrote:
>I am haveing some difficulty understanding the '("%0.8x" % n)'
>notaion ...

The interactive interpreter is your friend:

    >>> "%0.8x" % 1234567
    '0012d687'
    >>> hex(1234567)
    '0x12d687'

Looking at libc stdio documentation may be useful as well.

  Neil



More information about the Python-list mailing list