Re: query on python list

2005-12-30 Thread Larry Bates
I'm having trouble determining what you want but I think there are a couple of problems in your code: list2 = ['1','2','5',4] did you mean list2 = ['1','2','3','4'] Note missing quotes around the 4 and 5 instead of 3 If you want to know if list2 is found in list 1 it is as simple as: if list2

Re: query on python list

2005-12-27 Thread Mike Meyer
[EMAIL PROTECTED] writes: > hi tim > thanks for the help > acutally i dint tell u the whole problem > i have list of lists, for ex > > list1 =[ ['a','b','c','d','e'] , ['1','2','3','4'] , ['A','B','C','D'] > ] > > and another list > > list2 = ['1','2','5',4] > > now am searching the items of list2

Re: query on python list

2005-12-27 Thread muttu2244
hi tim thanks for the help acutally i dint tell u the whole problem i have list of lists, for ex list1 =[ ['a','b','c','d','e'] , ['1','2','3','4'] , ['A','B','C','D'] ] and another list list2 = ['1','2','5',4] now am searching the items of list2 in list1 as below Found = True for i in list1:

Re: query on python list

2005-12-27 Thread Tim Hochberg
[EMAIL PROTECTED] wrote: > hi all > am searching for a key in a list, am using > > Found = 0 > for item in list: > if not key == item: > Found = 0 > elif key == item: > Found =1 > > Now based on the Found value i ll manipulate the list. > but whenev