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