Converting a hex string to a number

Matt Gerrans matt_gerrans at hp.com
Tue Jul 9 17:41:35 EDT 2002


> >> eval!
> >
> >Overkill. Unsafe. Ugly. Lame.
> >
>
> What do you mean by unsafe?

Also, in addition to the criticism of the suggested method (eval), you could
post your simpler, safe and able-bodied alternative.   Perhaps it was:

try:
   n = eval(string)
except:
   n = 0





More information about the Python-list mailing list