I find myself repeatedly writing the same chunk of code:
def stringInList(str, list):
retVal = False
for item in list:
if str in item:
retVal = True
return retVal
Is there any way I can write this function quicker/with less code? I usually use this in an if statement, like this:
if stringInList(str, list):
print 'string was found!'