Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>: > This is better written as: > > if any(substr in inp1 for substr in > ['AND', 'OR', 'NOT', '>', '&', 'MAYBE', '(', '*', ' " ']): > print 'FINE'
Or, equivalently: for substr in ['AND', 'OR', 'NOT', '>', '&', 'MAYBE', '(', '*', ' " ']: if substr in inp1: print('FINE') break Marko -- https://mail.python.org/mailman/listinfo/python-list