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 asx1 and x2 and ..., notx1 or x2 or ...Use
any()instead.