Why this work
for td in alltd:
if "style3" in td["class"] or "style4" in td["class"] or "style1" in td["class"]:
td["class"] = "s1"
and this not?
for td in alltd:
if all(x in td["class"] for x in ("style3", "style4", "style1")):
td["class"] = "s1"
all([x1,x2,...]) is basically the same as x1 and x2 and ..., not x1 or x2 or ...
>>> all([True, True])
True
>>> all([True, False])
False
Use any() instead.
>>> any([True,False])
True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With