Python论坛  - 讨论区

标题:Re: [python-chinese] 怎样截取字段

2006年05月01日 星期一 00:59

Shixin Zeng zeng.shixin at gmail.com
Mon May 1 00:59:44 HKT 2006

On 4/30/06, biosedit at gmail.com <biosedit at gmail.com> wrote:
>
> |#!/usr/bin/python
>    3 |# This Python file uses the following encoding: utf-8
>    4 |import re
>    5 |pattern='^[^1]'
>    6 |f=open('/var/log/apache2/access.log','r')
>    7 |readlines=f.readlines()
>    8 |for str in readlines:
>    9 |     li =re.compile(pattern)
>   10 |    li.search(pattern).groups()
>   11 |f.close()
>      |


这该不会就是你的源代码吧?你把行号都copy过去了?这肯定是不行的。

File "./http.py", line 9
>     li.search(pattern).groups()
>                               ^
> IndentationError: unindent does not match any outer indentation level
>
> http://www.woodpecker.org.cn/obp/diveintopython-zh-5.4/zh-cn/dist/html/toc/index.html
> groups()该怎么用
>
> _______________________________________________
> 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
>
>


--
Best Regards

Shixin Zeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060501/5e77c03c/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年05月01日 星期一 11:06

biosedit at gmail.com biosedit at gmail.com
Mon May 1 11:06:04 HKT 2006

2006/5/1, Shixin Zeng <zeng.shixin at gmail.com>:
>
>
>
> On 4/30/06, biosedit at gmail.com <biosedit at gmail.com> wrote:
> > |#!/usr/bin/python
> >    3 |# This Python file uses the following encoding: utf-8
> >    4 |import re
> >    5 |pattern='^[^1]'
> >    6 |f=open('/var/log/apache2/access.log','r')
> >    7 |readlines=f.readlines()
> >    8 |for str in readlines:
> >    9 |     li =re.compile(pattern)
> >   10 |    li.search(pattern).groups()
> >   11 |f.close()
> >      |
>
>
> 这该不会就是你的源代码吧?你把行号都copy过去了?这肯定是不行的。
>
不是,这个编辑器里的行号
> >
>  File "./http.py", line 9
>     li.search(pattern).groups()
>                               ^
> IndentationError: unindent does not match any outer indentation level
> http://www.woodpecker.org.cn/obp/diveintopython-zh-5.4/zh-cn/dist/html/toc/index.html
> groups()该怎么用
>
> _______________________________________________
> 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
>
>
>
>
>  --
> Best Regards
>
> Shixin Zeng
> _______________________________________________
> 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
>
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号