2005年04月06日 星期三 10:01
may be you should consider the two flag: from manual of re module M MULTILINE When specified, the pattern character "^" matches at the beginning of the string and at the beginning of each line (immediately following each newline); and the pattern character "$" matches at the end of the string and at the end of each line (immediately preceding each newline). By default, "^" matches only at the beginning of the string, and "$" only at the end of the string and immediately before the newline (if any) at the end of the string. S DOTALL Make the "." special character match any character at all, including a newline; without this flag, "." will match anything except a newline. anyway, if you cannot get it done by yourself, you can put it in the mail-list, and we can help you. -----Original Message----- From: python-chinese-bounces at lists.python.cn [mailto:python-chinese-bounces at lists.python.cn] On Behalf Of 逸飞 张 Sent: Tuesday, April 05, 2005 10:31 PM To: python-chinese at lists.python.cn Subject: Re: [python-chinese] python中怎么实现sed的功能 使用了一下,感觉不错。 但还是不知道怎么完成多行匹配,即要匹配的模式可能在一行上也可能在多行上, 而且分行的位置不是很确定。 --- Jacob Fan <jacob at exoweb.net> wrote: > 请看re模块的文档, 其中module content一节. > 逸飞 张 wrote: > > > > 有相关的module还是使用re模块,替换之类的功能怎么实现。 > > 请举个例子,谢谢。 > > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > _________________________________________________________ Do You Yahoo!? 150万曲MP3疯狂搜,带您闯入音乐殿堂 http://music.yisou.com/ 美女明星应有尽有,搜遍美图、艳图和酷图 http://image.yisou.com 1G就是1000兆,雅虎电邮自助扩容! http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/ma il_1g/ _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese
Zeuux © 2025
京ICP备05028076号