Home  >  Q&A  >  body text

python提示解码出错

driver.implicitly_wait(3)
html=driver.page_source
f=open("D://auto.txt",'a')
html.replace(u'\xa0','ignore')
content=html.encode('gbk','ignore')
html=content.decode('gbk')
f.write(html)

replace空格,莫名其妙的不能生效,我也不知道为什么,最后只好ignore了
然后通过代码,但是生成的文件内容乱七八糟。
用的火狐浏览器下载的源码

迷茫迷茫2740 days ago542

reply all(0)I'll reply

No reply
  • Cancelreply