What do I do to read html files on my pc?

Chris Angelico rosuav at gmail.com
Mon Aug 27 10:41:46 EDT 2012


On Mon, Aug 27, 2012 at 11:51 PM, mikcec82 <michele.cecere at gmail.com> wrote:
> I have this html data and I want to check if it is present a string "XXXX" or/and a string "NOT PASSED":

Start by scribbling down some notes in your native language (that is,
don't bother trying to write code yet), defining exactly what you're
looking for. What constitutes a hit? What would be a false positive
that you need to avoid? For instance:

* The string XXXX must occur outside of any HTML tag.
or:
* The string XXXX must occur inside a <td> but not inside <samp>.
or:
* The string XXXX must be in the first <td> inside of a <tr> in the
<table> that immediately follows the text "abcdefg".

Make sure it's clear enough that anybody could follow it, even without
knowing everything you know about your files. Once you have that
algorithmic description, it's simply a matter of translating it into a
language the computer can handle; and that's fairly straight-forward.
An hour or two with language/library documentation and you'll quite
possibly have working code, or if you don't, you'll at least have
something that you can show to the list and ask for help with.

But until you have that, advice from this list is going to be fairly
vague, and may turn out to be quite misleading. We can't solve your
problem until we know what it is, and you can't tell us what the
problem is until you know yourself.

ChrisA



More information about the Python-list mailing list