Paul Rubin wrote:
> My favorite way to convert strings to numbers is with binascii:
 >
>  from binascii import hexlify
>  def s2num(text):
>    return int(hexlify(text), 16)


Neat. I use the empty string as a binary representation of zero,
which you can accommodate with:

def s2num(text):
     return int(hexlify(text) or '0', 16)


-- 
--Bryan
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to