实现URL编码解码的python程序_Linxh_百度空间

实现URL编码解码的python程序_Linxh_百度空间

实现URL编码解码的python程序
2006-12-30 14:40

#!/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

解码使用unqute和decode函数

原文地址:https://www.cnblogs.com/lexus/p/2405138.html