在网络怕爬虫过程中遇到,编码错误
'gbk' codec can't encode character '\ue5d1' in position 0: illegal multibyte sequence
response = requests.get(url) html_uid = response.text # name=html_uid["result"]['name'] # path = "E:\\python_py\\景区详情\\省份\\吉林省\\"#文件路径" file_path =cities_folder+province+city+'_'+str(i)+"_"+str(j)+'.json' file = open(file_path, 'w') file.writelines(html_uid) file.close()
修改部分
file = open(file_path, 'w')增加
encoding='utf-8'
即 file =open(file_path,'w',encoding='utf-8')
點擊查看更多內(nèi)容
為 TA 點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦