以此为起点.. http://docs.python-guide.org/en/latest/scenarios/scrape/
from lxml import html
import requests
page = requests.get('http://econpy.pythonanywhere.com/ex/001.html')
tree = html.fromstring(page.text)
一切都按预期工作..但是,....
from lxml import html
import requests
page = requests.get('http://www.streetinsider.com/ipo_history.php?type=upcoming')
tree = html.fromstring(page.text)
给出这个错误...
File "<string>", line unknown
XMLSyntaxError: line 1: Document is empty
使用 pyquery....
from pyquery import PyQuery as pq
from lxml import etree,html
import requests
response = pq(url='http://www.streetinsider.com/ipo_history.php?type=upcoming')
doc = pq(response.content)
抛出此错误...
File "<string>", line unknown
XMLSyntaxError: line 1504: Unexpected end tag : h2
从网页获取表格的任何帮助。