Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
标题非常不言自明。如果 16 个不同变量中的任何一个为真,我想要一个条件得到满足,但我觉得必须有一种更好/更清洁的方法来做到这一点,而不是输入 if A = True 或 B = True .... 等等。在那儿?
您可以使用any():
any()
any([A, B, ...])