Sep-27-2021, 02:16 AM
(Sep-26-2021, 04:38 PM)SamHobbs Wrote:(Sep-26-2021, 11:05 AM)knight2000 Wrote: So I followed your suggestion to use lxml and tried the following code:In your fixed code you first find relevant div elements then look for a relevant span element and I think the requirement for the div elements was not in the original question. You were saying the code does not determine when there is not a match and I could not understand what that means.
The sample file I provided contained one record where the span class of "w_A w_C w_B mr1 mt1 ph1" did exist and one record where the span class "w_A w_C w_B mr1 mt1 ph1" did not exist.
In my original code, for starters I was trying to do a 'for loop' using soup which is incorrect as snippsat taught me.