不是所有使用Python在findAll中返回的标记

2024-10-02 20:39:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我真的被这个难住了。我想在下面的URL http://www.lse.co.uk/ShareTrades.asp?shareprice=IQE&share=iqe返回最近交易表中的所有行,但是从findAll只返回了16行。你知道吗

import urllib2
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen('http://www.lse.co.uk/ShareTrades.asp?shareprice=IQE&share=iqe').read())
tradesdate = soup.findAll("div",{"class":"TradesDate"})
tradestime = soup.findAll("div",{"class":"TradesTime"})
i = len(tradesdate)
for counter in range (0,i-1):
    print tradesdate[counter].string + " | " + tradestime[counter].string
    i += 1

Tags: httpsharewwwcounteraspsoupukco