I would check 3 words at the starting of a line s=['foo','bar','qwe'] if ln.startswith(s): (this is bad) what is the best way for making it? if max(map(ln.startswith,s)): or reduce(lambda m,n:m or n, map(ln.startswith, s)) Thanks!