match pattern

Ian Kelly ian.g.kelly at
Mon Sep 20 21:15:30 CEST 2010

On Mon, Sep 20, 2010 at 12:58 PM, rudikk00 <rudikk99 at> wrote:

> Hi all,
> I remember perl has a match function =~/H/ --> which searches if there
> is "H" pattern in line. Is there a reasonable analog of it in python?

Yes, have a look at the re module in the standard library.

If all you're interested in is exact matches and not regular expressions,
you can also use the "in" operator:

if "H" in my_string:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list