[Tutor] Checking for string in a list strangeness

Kent Johnson kent37 at tds.net
Mon Apr 6 12:30:44 CEST 2009


On Mon, Apr 6, 2009 at 3:30 AM, AdamC <kabads at gmail.com> wrote:
> I'm writing a small cgi application for children to use and I want to
> check that the name they enter isn't a swear word.

> #for i in swearlist:       # shows swear list OK
> #    print i;

Perhaps the words in swearlist include some  whitespace? Try
for i in swearlist:
  print repr(i)

and look for leading and trailing spaces, tabs, etc.

Kent


More information about the Tutor mailing list