python - how to encode a url with urllib or urllib2 -


मुझे example.com/page.html जैसे एक कोड को something like उदाहरण चाहिए .com / a $ xDzf9D84qGBOeXkXNstw% 3D% 3D106

यदि आप इसका मतलब है: < / P>

  & gt; & gt; & gt; आयात urllib, base64 & gt; & gt; & gt; Urllib.quote_plus ('example.com/page.html') 'example.com% 2Fpage.html' & gt; & gt; & gt; Base64.urlsafe_b64encode ('example.com/page.html') 'ZXhhbXBsZS5jb20vcGFnZS5odG1s'  

Comments