# parse.quote_plus --- url 编码
# parse.unquote_plus --- url 解码
from urllib import parse
url = 'http://www.baidu.com?query=python 基础教程'
print(parse.quote_plus(url)) #url 编码
print(parse.unquote_plus('http%3A%2F%2Fwww.baidu.com%3Fquery%3Dpython+%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B')) #url 解码