How to do this in Python...
Tim Peters
tim.one at comcast.net
Thu Jan 23 19:27:38 EST 2003
More information about the Python-list mailing list
Thu Jan 23 19:27:38 EST 2003
- Previous message (by thread): How to do this in Python...
- Next message (by thread): How to do this in Python...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Chad Netzer]
> match = re.match(pattern, string)
> if match is not None:
> # do something with match object
>
> Since if's can test for more than boolean values, and match is defined
> to return None when it fails to match anything, not a False value.
[Paul Rubin]
> Can a match object ever test as false?
Nope, and
if match:
is idiomatic in this context. Horrid listcomp abuse is not <wink>.
- Previous message (by thread): How to do this in Python...
- Next message (by thread): How to do this in Python...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list