[EMAIL PROTECTED] wrote:
> Hi all,
> Is there a simple python function to return the list index of the
> minimum entry in a list of lists?
> ie, for [[3,3,3,3], [3,3,3,1], [3,3,3,3]] to return 2,4.
> Or, same question but just for a list of numbers, not a list of lists.
> Thanks,
> Josh
Untested:
items = []
for x, a in enumerate(L):
for y, b in enumerate(a):
items.append((b, (x,y)))
x, y = min(items)[1]
You could also change this to a generator:
def f(L):
for x, a in enumerate(L):
for y, b in ebumerate(a):
yield b, (x,y)
x, y = min(f(L))[1]
--
http://mail.python.org/mailman/listinfo/python-list