python 將結果\u6210\u529f這種格式轉換成中文


python 將結果\u6210\u529f這種格式轉換成中文

1 import codecs
2 
3     def parse_page(self,response):
4         print('=========' + response.url)
5         with codecs.open('deng1.json','wb',encoding = "utf-8") as f:
6             f.write(response.body.decode('unicode_escape'))  #和codecs模塊結合使用,將結果\u6210\u529f這種格式轉換成中文

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM