I am trying to verify that any list item starts on a specific line. How can I do this with a for loop? IE:
anyStartsWith = False for item in myList: if item.startsWith('qwerty'): anyStartsWith = True
Use any() :
any()
any(item.startswith('qwerty') for item in myList)