【发布时间】:2013-12-25 22:03:05
【问题描述】:
我用python写了一个解析一些字符串的脚本。
问题是我需要检查字符串是否包含某些部分。 我发现的方式不够聪明。
这是我的代码:
if ("CondA" not in message) or ("CondB" not in message) or ("CondC" not in message) or ...:
有没有办法优化这个?对于这种情况,我还有 6 项其他检查。
【问题讨论】:
标签: python multiple-conditions