How to convert text to url syntax in Python?

I want to convert python str to URL syntax.

for instance

>>> u'ν•œκΈ€'.encode('utf-8') '\xed\x95\x9c\xea\xb8\x80' to '%ed%95%9c%ea%b8%80' 

Thanks in advance.

+4
source share
1 answer
 >>> import urllib2 >>> urllib2.quote('ν•œκΈ€') '%ED%95%9C%EA%B8%80' 
+10
source

All Articles