Sep-27-2021, 02:23 AM
Sorry Sam, I probably wasn't overly clear to address your full question.
The reason I changed the code in the end to include the additional div (unlike the original code), was because snippsat educated me that I shouldn't be using 'soup' in a 'for loop'.
The reason I changed the code in the end to include the additional div (unlike the original code), was because snippsat educated me that I shouldn't be using 'soup' in a 'for loop'.
(Sep-27-2021, 02:16 AM)knight2000 Wrote:(Sep-26-2021, 04:38 PM)SamHobbs Wrote: 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.