Problem with REGEX in Python
Martin P
martin_p at despam.com
Fri May 30 07:48:42 EDT 2003
"Peter Hansen" <peter at engcorp.com> schrieb im Newsbeitrag
news:3ED740CF.94215963 at engcorp.com...
> Martin P wrote:
> >
> > for a short exercise I have to write a Python-Skript which reads
different
> > lines from a file and prints out all lines which contain the words
"Python"
> > or "python" but not f.e. "pyTHon".
> >
> > I´ve build it like this:
> > p = re.compile('.*[pP][ython].*')
> You want something containing just "[pP]ython" most likely.
Thanks a lot!
More information about the Python-list
mailing list