Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL Decode with Python 3

Is there a way to URL decode a string in Python 3

to take something like this

id%253D184ff84d27c3613d%26quality%3Dmedium 

and decode it twice to get

id=184ff84d27c3613d&quality=medium 
like image 263
Vladiki Avatar asked Dec 25 '11 04:12

Vladiki


People also ask

How do I remove 20 from a URL in Python?

replace('%20+', '') will replace '%20+' with empty string.


Video Answer


1 Answers

Just use urllib.parse.unquote():

>>> import urllib.parse >>> urllib.parse.unquote('id%253D184ff84d27c3613d%26quality%3Dmedium') 'id%3D184ff84d27c3613d&quality=medium' >>> urllib.parse.unquote('id%3D184ff84d27c3613d&quality=medium') id=184ff84d27c3613d&quality=medium 
like image 153
Blender Avatar answered Oct 19 '22 09:10

Blender