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

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -