[Tutor] Comparing to list elements

Bernard Lebel python at bernardlebel.com
Mon Aug 16 23:50:53 CEST 2004


Hello,

I wish to compare a variable value to the elements from a list.
For example:

aList = [ 'hi', 'hello', 'welcome' ]
sString = 'goodbye'


Now I want to check if 'goodbye' is present in aList, and if not, take
action.


Thanks
Bernard



More information about the Tutor mailing list