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