HowTo Search in nested lists
Florian Lindner
Florian.Lindner at xgm.de
Fri Jan 30 12:11:12 EST 2004
Hello,
I've two nested lists which are representing a table or matrix.
A = [1, 2, 3]
B = [4, 5, 6]
C = [7, 8, 9]
t = [A, B, C]
print t[0][2] # Prints 3
Now I found to search for certain values in a certain column.
For example: column 1, search for 5, return 1, because 5 is found in the
first column of the second element of t
I hope I could explain what I want. Is there any way to do that except:
for i in len(t):
if t[i][1] == "phrase":
found = i
break
Thx,
Florian
More information about the Python-list
mailing list