2005年12月05日 星期一 14:21
代码 import re s = 'Begin ' + 1000*'a very long string ' + 'end' re.match('Begin (\w| )*? end', s).end() 出错提示 Traceback (most recent call last): File "re.py", line 1, in ? import re File "E:\My Documents\work\PythonTest\re.py", line 3, in ? re.match('Begin (\w| )*? end', s).end() AttributeError: 'module' object has no attribute 'match' re是自带的吧?怎么会不行呢? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051205/85f87b10/attachment.html
2005年12月05日 星期一 14:43
import regex as re 原来还是regex,但是运行的时候提示用re,regex已经deprecated。 这怎么回事啊,我用的是python2.4.1 在05-12-5,HoLin <holin.he at gmail.com> 写道: > > 代码 > import re > s = 'Begin ' + 1000*'a very long string ' + 'end' > re.match('Begin (\w| )*? end', s).end() > > 出错提示 > Traceback (most recent call last): > File "re.py", line 1, in ? > import re > File "E:\My Documents\work\PythonTest\re.py", line 3, in ? > re.match('Begin (\w| )*? end', s).end() > AttributeError: 'module' object has no attribute 'match' > > re是自带的吧?怎么会不行呢? > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051205/87f484b0/attachment.htm
2005年12月05日 星期一 14:56
*Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 * 运行结果:_*19008*_ -- CopyLeft (C) Scorpio Auding -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051205/4cea4135/attachment.html
2005年12月05日 星期一 15:06
On 12/5/05, HoLin <holin.he at gmail.com> wrote: > > 代码 > import re > s = 'Begin ' + 1000*'a very long string ' + 'end' > re.match('Begin (\w| )*? end', s).end() > > 出错提示 > Traceback (most recent call last): > File "re.py", line 1, in ? > import re > File "E:\My Documents\work\PythonTest\re.py", line 3, in ? > re.match('Begin (\w| )*? end', s).end() > AttributeError: 'module' object has no attribute 'match' > > re是自带的吧?怎么会不行呢? > > 试试改文件名 re.py 改成 其他 比如 testRE.py -- simple is good http://datastrategy.org/number5 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051205/c6f7dc8e/attachment.htm
2005年12月05日 星期一 15:10
On 12/5/05, Scorpio Auding <auding at gmail.com> wrote: > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on > win32 > > 运行结果:19008 ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> s = 'Begin ' + 1000*'a very long string ' + 'end' >>> re.match('Begin (\w| )*? end', s).end() 19009 -- Best Regards, mep
2005年12月05日 星期一 15:11
我曾把文件名叫做 socket.py ,结果 ... On 12/5/05, Bruce Wang <number5 at gmail.com> wrote: > > On 12/5/05, HoLin <holin.he at gmail.com> wrote: > > > > 代码 > > import re > > s = 'Begin ' + 1000*'a very long string ' + 'end' > > re.match('Begin (\w| )*? end', s).end() > > > > 出错提示 > > Traceback (most recent call last): > > File "re.py", line 1, in ? > > import re > > File "E:\My Documents\work\PythonTest\re.py", line 3, in ? > > re.match('Begin (\w| )*? end', s).end() > > AttributeError: 'module' object has no attribute 'match' > > > > re是自带的吧?怎么会不行呢? > > > > > 试试改文件名 re.py 改成 其他 比如 testRE.py > > > -- > simple is good > http://datastrategy.org/number5 > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051205/348f0a7b/attachment.html
2005年12月05日 星期一 15:15
哈哈,真强,就是把文件取名为re了。 不过又没找到findall函数 =_=# 在05-12-5,Bruce Wang <number5 at gmail.com> 写道: > > On 12/5/05, HoLin <holin.he at gmail.com> wrote: > > > > 代码 > > import re > > s = 'Begin ' + 1000*'a very long string ' + 'end' > > re.match('Begin (\w| )*? end', s).end() > > > > 出错提示 > > Traceback (most recent call last): > > File "re.py", line 1, in ? > > import re > > File "E:\My Documents\work\PythonTest\re.py", line 3, in ? > > re.match('Begin (\w| )*? end', s).end() > > AttributeError: 'module' object has no attribute 'match' > > > > re是自带的吧?怎么会不行呢? > > > > > 试试改文件名 re.py 改成 其他 比如 testRE.py > > > -- > simple is good > http://datastrategy.org/number5 > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051205/0f7f8a0e/attachment.htm
2005年12月05日 星期一 17:14
在 2005年12月5日 星期一 15:15,HoLin 写道: > 哈哈,真强,就是把文件取名为re了。 > 不过又没找到findall函数 =_=# > > > 在05-12-5,Bruce Wang <number5 at gmail.com> 写道: > > > On 12/5/05, HoLin <holin.he at gmail.com> wrote: > > > 代码 > > > import re > > > s = 'Begin ' + 1000*'a very long string ' + 'end' > > > re.match('Begin (\w| )*? end', s).end() > > > > > > 出错提示 > > > Traceback (most recent call last): > > > File "re.py", line 1, in ? > > > import re > > > File "E:\My Documents\work\PythonTest\re.py", line 3, in ? 搞不懂,python安装的re文件怎么在这个目录下? E:\My Documents\work\PythonTest\re.py 去文档看看import搜索路径的顺序不就成了嘛 > > > re.match('Begin (\w| )*? end', s).end() > > > AttributeError: 'module' object has no attribute 'match' > > > > > > re是自带的吧?怎么会不行呢? > > > > 试试改文件名 re.py 改成 其他 比如 testRE.py > > > > > > -- > > simple is good > > http://datastrategy.org/number5 > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
Zeuux © 2025
京ICP备05028076号