Regular expression issue
genxtech
jrmy.lnrd at gmail.com
Mon Aug 9 09:18:35 EDT 2010
On Aug 8, 7:34 pm, Tim Chase <python.l... at tim.thechases.com> wrote:
> On 08/08/10 17:20, genxtech wrote:
>
> > if re.search(search_string, in_string) != None:
>
> While the other responses have addressed some of the big issues,
> it's also good to use
>
> if thing_to_test is None:
>
> or
>
> if thing_to_test is not None:
>
> instead of "== None" or "!= None".
>
> -tkc
I would like to thank all of you for your responses. I understand
what the regular expression means, and am aware of the double negative
nature of the test. I guess what I am really getting at is why the
last test returns a value of None, and even when using the syntax
suggested in this quoted solution, the code for the last test is doing
the opposite of the previous 2 tests that also returned a value of
None. I hope this makes sense and clarifies what I am trying to ask.
Thanks
More information about the Python-list
mailing list