我用beauthoulsoup绘制了一个表,我试图让它在某个单元格有特定字符串时打印整行。下面的代码完全没有打印出来,我不知道为什么。如果我没有for循环,只打印数据变量,我会得到大量的信息,所以这是我的for循环的问题。在
有什么想法吗?在nextpage=logged_in.read() #let's read the page once we get logged in
soup=BeautifulSoup(nextpage, "lxml") #BeautifulSoup told me to do this
table = soup.findAll("table", {'class':'table2'}) #Find the table we want to work with
data = [[td.findChildren(text=True) for td in tr.findAll("td")] for tr in table] #Find the cells for each table row
for line in table: #if you see a line in the table
if line.find('Check'): #and you find the specific string
print line #print it
print "Hey, this did run!" #debug statement