[Tutor] bug hunting again
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Mon, 8 Jul 2002 12:40:50 -0700 (PDT)
> If you're stuck using 1.52 and can't upgrade to a newer version, then you
> may need to reword things. The equivalent way of saying:
>
> if username.lower() in "kyle jason chelsea john cheryl".split():
>
> in 1.52 style would be:
>
> if string.lower(username) in \
> string.split("kyle jason chelsea john cheryl")
>
> (The line was getting long, so I use a "continuation" character '\' here
> to tell Python that there's more stuff on the next line.)
Oh, one other thing: if you do the above, you'll need to put the line:
###
import string
###
at the top of your program, so that Python knows that when we say
'string', we mean the standard 'string' library:
http://www.python.org/doc/lib/module-string.html
Hope this helps!