Home > other >  About python3 xpath collection web pages to load the local inconsistent results page
About python3 xpath collection web pages to load the local inconsistent results page

Time:04-10

 the from LXML import etree 
The import requests
Url="https://tieba.baidu.com/f/search/res? Isnew=1 & amp; Kw=& amp; 've C8 EB C8=% % % % BA& UN=& amp; Rn=10 & amp; Sd=& amp; Ed=& amp; Sm=1 & amp; Only_thread=1 & amp; Pn=0 '
The response=requests. Get (url)
The content=response. The text
Print (content)
HTML=etree. HTML (content)
Pics=HTML. Xpath ('//img/@/@ the original ')
Print (pics)
For PIC in pics:
Print (PIC)

I like to collect matching result is empty, but I type out the content and then put a.h HTML in this way can the normal match inside out is what reason, is really stupid
 the from LXML import etree 
F=open ('/a.h HTML ', 'rb')
The content=f.r ead ()
HTML=etree. HTML (content)
Pics=HTML. Xpath ('//img/@/@ the original ')
For PIC in pics:
Print (PIC)
  • Related