On Wednesday 14 April 2004 12:12, Angus Leeming wrote:
> Angus Leeming wrote:
> > I've started writing the equivalent in python (also attached), but
> > wonder if there is a simple way of extracting a substring 'fa' and
> > converting it to the equivalent decimal number '250'?
>
> Ok, got it.

  Your solution is the same the I would propose, if I were not in a 
talk. :-)


  Note that for python versions starting from 2.0 then

int( hex_str, 16)

  is enough where hex_str is the string with the hexadecimal 
representation of the number, and *int* is a built-in function, so no 
need to import any module for it.

  This is also the recommended way as the string module is deprecated 
(but it remain like that for long time, so you are on the safe side 
with it).

-- 
José Abílio

LyX and docbook, a perfect match. :-)

Reply via email to