0
I have a filter to find the index of a stripe inside another list (found in the author group Anderson Carlos)
fila = [['vitor','5'], ['vitor', '4']]
def sdb(filadb,nome,elemento):
if not (filadb):
return None
else:
filadb_l = filadb[0]
p = [(filadb_l.index(x), x.index(nome)) for x in filadb_l if nome in x] # linha 0 posicao 1
if p == []:
return None
else:
p_e = [(fila_pe.index(x), x.index(elemento)) for x in fila_pe if elemento in x] # linha 0 posicao 1
p_linha = filadb_l[p[0][0]]
posicao_e = fila_pe[p_e[0][0]][1]
p_elemento = p_linha[posicao_e]
result = [p_linha]
return p_elemento
function return:
[5] That way I have only one element.
I’d like you to return the two elements to me. return:
['5','4']
Possibly duplicated. https://answall.com/questions/210238/comorbuscar-um-elemento-em-uma-lista-que-est%C3%A1-within-another-list
– Barbetta
It’s not the same thing. As a website, it’s another question. I’ve seen this post.
– vitor Carvalho
What exactly was your attempt? Put the code in the question, please.
– Woss
Anderson Carlos Woss 10 months ago a question was asked "How to find an element in a list that is inside another list". Vc made a simple way that helped me a lot "[(list.index(x), x.index(value)) for x in list if value in x]". Thanks in advance
– vitor Carvalho
I managed to solve it. Later put the formula.
– vitor Carvalho
What do you need to do? Find the index of a value or find all values in a given index?
– Woss