(May-24-2021, 11:05 AM)knight2000 Wrote: I'm not sure if that's the correct or best way to go about it, but the results are:Probably could fix it earlier when parse out the values to not get duplicates,like using CSS selector in BS
select()
and select_one()
to get right tags. range(len(sequence)) is looked as a bad way in most cases,
can maybe be justified here as use
step
parameter in range()
here,that enumerate()
dos not have.An other way remove duplicate then loop.
prices = [ "$139,501", "$139,501", "$137,349", "$137,349", "$132,955", "$132,955", "$129,000", "$129,000", ] for item in dict.fromkeys(prices): print(item)
Output:$139,501
$137,349
$132,955
$129,000
Just remove duplicates without care about order would be to use set()
.>>> set(prices) {'$132,955', '$139,501', '$129,000', '$137,349'}