On 3/14/2011 3:13 PM, Mike Franon wrote:
Thank you everyone who responded, very fast responses I am impressed.
OK now I see where I went wrong and had to do
if (i == 'test1') or (i=='test2'):
I guess I was thinking if I do
a = ['test1', 'flag', 'monday']
for i in a:
It would check each item in the list one at a time like a loop I was
thinking, so the first time it would test for 'test1', and the second
time it would test for 'flag',
That is correct. Each iteration of the loop assigns one list element to a.
if (i == 'test1') or (i=='test2'): is one way to do what you want.
Another is if i in ('test1', 'test2'):
Instead of a tuple of values you could also provide a list, a set or a
dictionary.
--
Bob Gailer
919-636-4239
Chapel Hill NC
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor