genxtech wrote:
On Aug 8, 7:34 pm, Tim Chase <python.l...@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.

It returns None because it doesn't match.

Why doesn't it match?

Because the regex wants the last character to be a 'y', but it isn't,
it's a 'a'.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to