您正在尝试引用Unipre数据,因此需要确定如何将其转换为URL安全字节。
首先将字符串编码为字节。经常使用UTF-8:
>>> import urllib>>> urllib.quote(u'schxe9nefeld')/opt/local/Library/frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py:1268: UnipreWarning: Unipre equal comparison failed to convert both arguments to Unipre - interpreting them as being unequal return ''.join(map(quoter, s))Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1268, in quote return ''.join(map(quoter, s))KeyError: u'xe9'>>> urllib.quote(u'schxe9nefeld'.enpre('utf8'))'sch%C3%A9nefeld'However, the encoding depends on what the server will accept. It’s best to
stick to the encoding the original form was sent with.



