[Tutor] Perl refugee
Sean 'Shaleh' Perry
shalehperry@attbi.com
Fri, 26 Apr 2002 09:19:40 -0700 (PDT)
>
> So will i have to use a bunch of cludgy if/then statements, or is there
> something more elequent...
>
> if subval > "0001" and subval < "0010" :
> <filecopyingsteps>
> elif subval > "0009" and subval < "0020" :
> <filecopyingsteps>
> ........
>
(like perl has a case statement? well, 6 will ....)
Yes you can use the if statement, this is standard practice. The other option
is to store the info in a dictionary and key off the dictionary. This works
for menus and the like, it may not here because you are using a range.
BTw a nifty python ism is:
if "0001" < subval < "0010": foo