Python style questions

Joshua Marshall jmarshal at mathworks.com
Fri Mar 16 11:40:10 EST 2001


Cary O'Brien <cobrien at radix.net> wrote:
...
> 3. I really miss not having a "switch" or "case" statement.  Sniff.

Me too.

> 4. I need to change things like "88aa99bb" (hex string) into integers.  Should I

>    a. use expr("0x"+s) 
>    b. not use such things
>    c. ???

c. int(s, 16)

This works in Python 2.x.  If you're using an older version, use string.atoi.



More information about the Python-list mailing list