Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import urllib2
- city = u'Köln'
- def make_url(word):
- Word = unicode(word)
- print type(Word)
- url_Word = urllib2.quote(Word, "utf-8")
- print "ntype = %s n" %type(Word)
- print "url_word = %s n" %url_Word
- make_url(city)
- <type 'unicode'>
- type = <type 'unicode'>
- url_word = K%F6ln
- <type 'unicode'>
- C:Python27liburllib.py:1285: UnicodeWarning: Unicode equal comparison failed
- to convert both arguments to Unicode - interpreting them as being unequal
- return ''.join(map(quoter, s))
- Traceback (most recent call last):
- File "to_Ask_question.py", line 21, in <module>
- make_url(city)
- File "to_Ask_question.py", line 16, in make_url
- url_Word = urllib2.quote(Word, "utf-8")
- File "C:Python27liburllib.py", line 1285, in quote
- return ''.join(map(quoter, s))
- KeyError: u'xf6'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement