john
john

Reputation: 2164

How to convert text into URL syntax on Python?

I want to convert Python string to URL syntax.

For example

>>> u'한글'.encode('utf-8')
'\xed\x95\x9c\xea\xb8\x80' to '%ed%95%9c%ea%b8%80'

Upvotes: 4

Views: 6597

Answers (1)

Pär Wieslander
Pär Wieslander

Reputation: 28934

>>> import urllib2
>>> urllib2.quote('한글')
'%ED%95%9C%EA%B8%80'

Upvotes: 10

Related Questions