可以直接处理中英混排的url
from urllib.parse import quote (python3)
from urllib import quote (python2)
url = 'http://www.baidu.com?search=中文在这里'
不带附加参数print('n不带附加参数:n%s' % quote(url))
附带不转换字符参数print('n附加不转换字符参数:n%s' % quote(url, safe='/:?='))

可以直接处理中英混排的url
from urllib.parse import quote (python3)
from urllib import quote (python2)
url = 'http://www.baidu.com?search=中文在这里'
不带附加参数print('n不带附加参数:n%s' % quote(url))
附带不转换字符参数print('n附加不转换字符参数:n%s' % quote(url, safe='/:?='))