我正在使用 GAE python 2.5 和 Beautiful Soup 3.08,并且正在发生一些事情,切断了我的文本的第一部分。
这是我的代码:
from google.appengine.api import urlfetch
from BeautifulSoup import BeautifulSoup
url = 'http://www.cmegroup.com/CmeWS/mvc/xsltTransformer.do?xlstDoc=/XSLT/da/DailySettlement_CPC-FUT.xsl&url=/da/DailySettlement/V1/DSReport/ProductCode/J4/FOI/FUT/EXCHANGE/XNYM/Underlying/J4?tradeDate=08/16/2012'
print '<hr>This is the raw result fetched (print result.content)<hr>'
result = urlfetch.fetch(url = url, method = urlfetch.GET)
print result.content
soup = BeautifulSoup(result.content)
print '<hr>This is prettified soup (soup.prettify)<hr>'
print soup.prettify()
print '<hr>here is the print out of iteration through the findall<hr>Go!<br>'
trSet = soup.findAll('tr')
if trSet is not None:
for i in trSet:
i.string
else:
print "Couldn't find TRs in Soup!"
我运行此代码的应用程序站点是:http ://mwp-test2.appspot.com/ 发生的事情是第一次打印根本没有发生。有任何想法吗?(我也遇到了 Beautiful Soup 的 findAll 问题,但我打算在弄清楚这个截断问题后问这个问题)