incrementing string/hex value from file and write back

Simon Forman sajmikins at gmail.com
Thu Aug 20 17:38:08 EDT 2009


On Aug 20, 5:18 pm, "Rami Chowdhury" <rami.chowdh... at gmail.com> wrote:
> > val = val.encode('hex')
>
> That's the crucial line -- it's returning a new integer, which you are  
> re-binding to val. If you then did:

No, it returns another string, which still isn't the decimal
representation of the hex string.  hex C => decimal 12

In [1]: '0C'.encode('hex')
Out[1]: '3043'



More information about the Python-list mailing list