python+requests——URL的编码和解码


 

 

 

from urllib.parse import  quote,unquote

d = {'lang':'python','type':'testing','ccountry':quote('中国')}

print(d)                                   #执行结果:{'lang': 'python', 'type': 'testing', 'ccountry': '%E4%B8%AD%E5%9B%BD'}

print(unquote('%E4%B8%AD%E5%9B%BD'))       #执行结果:中国

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM