What RE would i use to match this whole word?
thecalm at NOSPAM.btinternet.com
Mon Jul 30 13:50:28 CEST 2001
YIPPEEEE!!!! thats it, of course its not a string, doh, how foolish of me.
he he.. anyway thanks m8.
"Cliff Crawford" <cjc26 at nospam.cornell.edu> wrote in message
news:irV87.147995$EF2.19745941 at typhoon.nyroc.rr.com...
> * G. Willoughby <thecalm at NOSPAM.btinternet.com> menulis:
> | this is the code im using for a 'file file' kinda program:
> | [snip]
> | def search(resultPane, dir, files):
> | searchString = re.compile(str(entryField.get()), re.IGNORECASE) #
> | search string
> | for file in files:
> | if searchString.search(file) == "None":
> None is *not* a string, it's a unique object. Since search() never
> returns a string, your comparison always fails and your else: branch
> always gets executed no matter what. Change this line to:
> if searchString.search(file) is None:
> if not searchString.search(file):
> to make it work.
> Cliff Crawford http://www.sowrong.org/
> A sign should be posted over every campus toilet:
> "This flush comes to you by courtesy of capitalism."
> -- Camille Paglia
More information about the Python-list