1.获取url参数
from urllib import parse
url = "https://docs.python.org/3.5/library/urllib.parse.html?highlight=parse#module-urllib.parse"
result = parse.urlparse(url)
print(result.query)
print(parse.parse_qs(result.query))
print(parse.parse_qsl(result.query))
2.url 编码
from urllib import parse
print(parse.quote("@"))
3.url 解码
from urllib import parse
print(parse.unquote("%40"))
base_url="https://index.baidu.com/api/NewsApi/checkNewsIndex?dates%5B%5D=2019-11-16%2C2019-11-23%2C2019-11-27%2C2019-12-05&type=day&words=%E8%BF%BD%E6%88%91%E5%90%A7"
url=parse.unquote(base_url)