HTML Code - Line Number

SMac2347 at comcast.net SMac2347 at comcast.net
Fri Apr 27 13:09:57 EDT 2012


Hello,

For scrapping purposes, I am having a bit of trouble writing a block
of code to define, and find, the relative position (line number) of a
string of HTML code. I can pull out one string that I want, and then
there is always a line of code, directly beneath the one I can pull
out, that begins with the following:
<td align="left" valign="top" class="body_cols_middle">

However, because this string of HTML code above is not unique to just
the information I need (which I cannot currently pull out), I was
hoping there is a way to effectively say "if you find the html string
_____ in the line of HTML code above, and the string <td align="left"
valign="top" class="body_cols_middle"> in the line immediately
following, then pull everything that follows this second string.

Any thoughts as to how to define a function to do this, or do this
some other way? All insight is much appreciated! Thanks.



More information about the Python-list mailing list