title: Using Python and BeautifulSoup to find certain table cell value, then print the entire row?
body: <p>I have a table I'm scraping with BeautifulSoup and I'm trying to get it to print the whole row when a certain cell has a particular string. The code below is printing absolutely nothing and I cannot figure out why. If I don't have the for loop and I just print the data variable, I get a ton of information back, so it's something with my for loop.</p>
  
  <p>The thing is, I never know where the word "Check" is going to be or how many times it'll show up in my table, so I can't just look at the index. I've looked at <a href="https://stackoverflow.com/questions/6420005/using-python-and-beautifulsoup-to-parse-a-table">Using Python and BeautifulSoup to Parse a Table</a>, but it looks like it's just looking for tags, not for specific strings. I tried working with this info: <a href="http://www.briancarpio.com/2012/12/02/website-scraping-with-python-and-beautiful-soup/" rel="nofollow noreferrer">http://www.briancarpio.com/2012/12/02/website-scraping-with-python-and-beautiful-soup/</a>, but it knows exactly what indices to talk to, so it wasn't useful for me here.</p>
  
  <p>Any ideas?</p>
  
  <pre><code>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
  </code></pre>