R
Robert
Hi,
I have a little problem and mybe one of you has got the solution.
I would like to check if a string is in a list of strings.
The following returns true:
if 'hallo' in ['halloooo','hallooooooooo']:
pass
but I want to check if the string is exactly equal to any string in the
list.
How can I do this without the need to do something like this:
def stringInList(self,string,list):
for oneStr in list:
if string == oneStr:
return 1
return 0
Thank you in advance,
Robert
I have a little problem and mybe one of you has got the solution.
I would like to check if a string is in a list of strings.
The following returns true:
if 'hallo' in ['halloooo','hallooooooooo']:
pass
but I want to check if the string is exactly equal to any string in the
list.
How can I do this without the need to do something like this:
def stringInList(self,string,list):
for oneStr in list:
if string == oneStr:
return 1
return 0
Thank you in advance,
Robert