2004年02月21日 星期六 15:01
我如果想把<开头到 />结尾的内容替换成我指定的,或删除掉该如何写呢? 谢谢 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 网易VIP收费邮箱两周年超值优惠! 满1赠6!! http://vip.163.com 中国最大的免费邮箱在等你 25兆空间4兆附件! http://mail.163.com 点击网易泡泡惊喜无限 全免费手机短信任你发! http://popo.163.com
2004年02月21日 星期六 23:57
Hello debianx,
最简单的正则处理是也乎!
"""
import re
#编译表达式
re_match_tag=re.compile(
r"""(<\w{2,}.*?>)
""",
re.IGNORECASE |
re.DOTALL |
re.VERBOSE)
#进行操作
sub(re_match_tag, "", myString)
sub(re_match_tag, "<替换>", myString)
"""
=== [ 15:01 ; 04-02-21 ] you wrote:
d> 我如果想把<开头到 />结尾的内容替换成我指定的,或删除掉该如何写呢?
d> 谢谢
d> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
d> 网易VIP收费邮箱两周年超值优惠! 满1赠6!! http://vip.163.com
d> 中国最大的免费邮箱在等你 25兆空间4兆附件! http://mail.163.com
d> 点击网易泡泡惊喜无限
d> 全免费手机短信任你发! http://popo.163.com
=== === === === === === === === === ===
--
Best regards,
Zoom.Quiet
/=======================================\
]Time is unimportant, only life important![
\=======================================/
2004年02月23日 星期一 09:00
一些小的scripts我一般申明为gb2312或utf-8。如果是大一点的工程,我一般不申明 encoding,全部用英文,然后利用gettext转换为中文。 >From: "John Li" <johnli at ahlt.net> >To: <python-chinese at lists.python.cn> >Subject: [python-chinese] encodings >Date: Fri, 20 Feb 2004 14:38:43 -0500 > >您们号: > 我住在美国,想知道在中国大部分的人怎么利用encodings。 >是不是所有的程序现在必须利用gb18030? 还有很多人 >利用gbk/cp936或是gb2312?说python的话,大部分的人 >把gb* 转换到utf-8?因为python利用utf-8,utf-8是不是比 >gb*有安全?我现在打算利用gb18030,把它转换到utf-8,在 >python程序里面利用utf-8,用完了,再把它转换到gb18030. >我想首先问你们这想法好不好。非常感谢!(对不起,中文不流利) > >John >_______________________________________________ >python-chinese mailing list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese _________________________________________________________________ 免费下载 MSN Explorer: http://explorer.msn.com/lccn/
2004年02月23日 星期一 09:46
John Li:
您好!
我现在尽量使用UTF-8,这是为了可以更好的适应内核。如果用在服务端,我想用UTF-8或GB-18030比较好,这样可以最大程度的适应多语种。至于用在客户端,则要考虑兼容性,这时应用GB2312更好一些(对应的编码是MDSC?)。
======= 2004-02-21 03:38:43 您在来信中写道:=======
>您们号:
> 我住在美国,想知道在中国大部分的人怎么利用encodings。
>是不是所有的程序现在必须利用gb18030? 还有很多人
>利用gbk/cp936或是gb2312?说python的话,大部分的人
>把gb* 转换到utf-8?因为python利用utf-8,utf-8是不是比
>gb*有安全?我现在打算利用gb18030,把它转换到utf-8,在
>python程序里面利用utf-8,用完了,再把它转换到gb18030.
>我想首先问你们这想法好不好。非常感谢!(对不起,中文不流利)
>
>John
>_______________________________________________
>python-chinese mailing list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
= = = = = = = = = = = = = = = = = = = =
致
礼!
刘鑫
lx1978 at 21cn.com
2004-02-23
Zeuux © 2025
京ICP备05028076号