>>> print 'xn--'+'教育部'.decode('gbk').encode('punycode')+'.cn' xn--wcvs22dzol.cn >>> ___________________________________________ >>>import urllib >>>s="%D6%D0%B9%FA" >>>urllib.unquote(s) '\xd6\xd0\xb9\xfa' >>>s='中国' >>>urllib.unquote(s) '%D6%D0%B9%FA' >>> s={'a':'中国'} >>> urllib.urlencode(s) 'a=%D6%D0%B9%FA' >>> |