[Python-Dev] Ask a question for a script about re.findall Modlue
Guido van Rossum
guido at python.org
Sat May 22 02:09:37 CEST 2010
You shouldn't be asking questions about using Python on python-dev -- this
list is for development of Python.
Your problem is easily explained however: the second argument to p.findall()
should be an offset, not a flag set. (You are confusing re.findall() and
p.findall().)
--Guido
On Fri, May 21, 2010 at 4:32 PM, Lu, Hongchao (UI Health Care) <
luhon at healthcare.uiowa.edu> wrote:
> Hi All,
>
> I am working on a script to use re.findall,
>
> But the result seems wield.
>
> --------------------------------------------------------------------
>
> import re
>
> p=re.compile("\S+",re.M)
>
> pirfile="""
>
> >DL;mm9|
>
> >DL;petMar1|
>
> >DL;cavPor3|
>
> >DL;mm9|:
>
> """
>
> for m in p.findall(pirfile,re.M):
>
> print m
>
> Results:
>
> |
>
> >DL;petMar1|
>
> >DL;cavPor3|
>
> >DL;mm9|
>
> The first result is missing some characters, Could you explain why? Any
> wrong with the script?
>
> I tried Python2.4/2.6/2.7, the result is same.
>
> Thank you.
>
> Hongchao Lu
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100521/87d05100/attachment-0001.html>
More information about the Python-Dev
mailing list