Simple ascii url encoding with python

后端 未结 6 1271
不思量自难忘°
不思量自难忘° 2021-01-16 12:23

look at that:

import urllib
print urllib.urlencode(dict(bla=\'Ã\'))

the output is

bla=%C3%BC

what I want

6条回答
  •  爱一瞬间的悲伤
    2021-01-16 13:01

    Package unihandecode is

    US-ASCII transliterations of Unicode text.
    an improved version of Python unidecode, that is Python port of Text::Unidecode Perl module by Sean M. Burke .

    pip install Unihandecode
    

    then in python

    import unihandecode
    print(unihandecode.unidecode(u'Ã'))
    

    prints A.

提交回复
热议问题