fork download
  1. from itertools import product, chain
  2.  
  3. lista = [['julian', '0', '4', '4'], ['ana', '10', '4']]
  4.  
  5. def get_all_indexes(lista, valor):
  6. return (i for i, v in enumerate(lista) if v == valor)
  7.  
  8. def search(lista, valor):
  9. return (list(product([indice], get_all_indexes(sublista, valor)))
  10. for indice, sublista in enumerate(lista) if valor in sublista)
  11.  
  12. print( list(search(lista, '4')) )
Success #stdin #stdout 0.02s 9364KB
stdin
Standard input is empty
stdout
[[(0, 2), (0, 3)], [(1, 2)]]