python newbie having strangeness

Tony C cappy2112 at
Sat Feb 28 02:22:10 CET 2004

Joe F. Blow <dood at> wrote in message > count=binlist=0

this may be of some use in converting from hex to decimal

WholeFile= file.readlines()

# now, you have to search for the location of the decimal numbers
# I can't specify how to do that, without knowing what your input file looks #like

#but once you have a string as in

HexStr ="123ABCDE" #implied is that this string was read from a file
(you MUST strip off any leading 0x, or trailing H or h, before proceeding)

You can convert it to a decimal string by
DecStr = "%lu" % long(HexStr,16)
and to an integer by
DecNum = long(DecStr)

More information about the Python-list mailing list