[Tutor] How Match a Dot?

Kent Johnson kent37 at tds.net
Wed Sep 24 04:12:15 CEST 2008

On Tue, Sep 23, 2008 at 10:02 PM, Wayne Watson
<sierra_mtnview at sbcglobal.net> wrote:
> How do I match a dot in, for example, abc.txt? I want to match it exactly.
> There must be some sort of escape.

Assuming you want to match in a regular expression, use \ as an escape
and use raw strings.

In [40]: import re

In [41]: m=re.search(r'\.', 'abc.de')

In [43]: m.start()
Out[43]: 3


More information about the Tutor mailing list