It is usual to check for an item in a list, tuple, or dict using 'in' operator.
List=[ 'l' , 'i' , 's' , 't']
if 's' in List:
print "success"
for string we usually go with 'find' function. Its quite easier to go with 'in' operator for string too.
0 comments:
Post a Comment