Chinaunix

标题: URL编码的Python程序 [打印本页]

作者: didonglin    时间: 2009-05-25 10:58
标题: URL编码的Python程序

#!/usr/bin/python
import urllib
import sys
string = sys.argv[1]
string = unicode(string,"gbk")
utf8_string = string.encode("utf-8")
gbk_string=string.encode("gbk")
gbk=urllib.quote(gbk_string)
utf8=urllib.quote(utf8_string)
print gbk
print utf8
原文地址
http://oss.lzu.edu.cn/modules/newbb/viewtopic.php?topic_id=722


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/94754/showart_1943889.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2