Multiple value checks using 'in' operator (Python) -


if 'string1' in line: ... 

... works expected if need check multiple strings so:

if 'string1' or 'string2' or 'string3' in line: ... 

... doesn't seem work.

if any(s in line s in ('string1', 'string2', ...)): 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

linux - gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now -

sql - MySQL - Finding Empty relations -