incrementing string/hex value from file and write back

Rami Chowdhury rami.chowdhury at gmail.com
Thu Aug 20 23:44:57 CEST 2009


Of course - my apologies, I was being an idiot.

On Thu, 20 Aug 2009 14:38:08 -0700, Simon Forman <sajmikins at gmail.com>  
wrote:

> 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'



-- 
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --  
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)



More information about the Python-list mailing list