I haven't been able to find a simple way to do this, i have been following this and I have written the following,
##just comments before this
import lxml,requests
23 page = requests.get('https://finalexams.rutgers.edu.html')
24
25 tree = html.fromstring(page.text)
26
27 tableRow = tree.xpath('//tr/text() ' )
28
29 print 'Rows' , tableRow
That script needs to parse through table rows like these and take out the things inside of them, but there could be a potentially infinite amount of table rows. I don't know how to access nested tags and they don't have unique names or ID's for me to look for.
How can I write a for loop that gets each of these table rows and lets me grab the individual bits of them?
<tr>
<td> 04264</td>
<td>01:198:205</td>
<td>01</td>
<td>INTR DISCRET STRCT I</td>
<td>C</td>
<td>Dec 17, 2014: 8:00 AM - 11:00 AM </td>
</tr>
<tr>
<td> 09907</td>
<td>01:198:214</td>
<td>01</td>
<td>SYSTEMS PROGRAMMING</td>
<td>C</td>
<td>Dec 18, 2014: 8:00 PM - 11:00 PM </td>
</tr>
tree = html.fromstring(page.text)isn't going to work withimport lxml; did you do afrom lxml import htmlsomewhere?