import urllib test = urllib.parse.quote("a=[1,2]") a%3D%5B1%2C2%5D urllib.parse.unquote(test) 'a=[1,2]'