UrlDecode在Python中的使用方法

avatar
作者
猴君
阅读量:0

在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 

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!