from urllib.parse import quote
from urllib.parse import urlencode
base_url = 'https://s.taobao.com/search?'
data = {
'q': 'ipad'
}
print('https://s.taobao.com/search?q='+quote('ipad'))
print(base_url+urlencode(data))
"""
quote 和 urlencode 的区别 urlencode 需要用字典
单个字符就用quote就行了,因为quote只需要字符串就行了
https://s.taobao.com/search?ipad
https://s.taobao.com/search?q=ipad
个人觉得还是urlencode用得多一点
原文:https://blog.csdn.net/laughing_l/article/details/78094073