urldecode

UrlDecode在Python中的使用方法

小樊
91
2024-06-18 00:21:59
栏目: 编程语言

在Python中,可以使用urllib.parse库中的unquote函数来进行URL解码。下面是一个简单的示例代码:

from urllib.parse import unquote

url = "https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dpython%26rlz%3D1C1GCEU_en%26oq%3Dpython%26aqs%3Dchrome..69i57j69i60l3j69i65j69i60.1242j0j4%26sourceid%3Dchrome%26ie%3DUTF-8"
decoded_url = unquote(url)

print(decoded_url)

运行以上代码会输出以下结果:

https://www.google.com/search?q=python&rlz=1C1GCEU_en&oq=python&aqs=chrome..69i57j69i60l3j69i65j69i60.1242j0j4&sourceid=chrome&ie=UTF-8

0
看了该问题的人还看了