I would like to check if a particular field in a list is equal to == "Open"
def mostrar():
with open("ficheiro2.txt") as arquivo:
i=0
for linha in arquivo:
linha = eval(linha)
if linha[i][2]=="Aberta":
i=i+1
print (linha)
mostrar()
the file contains
[['teste', '02-01-19', 'Aberta'],['teste2', '02-01-19', 'Aberta'],['teste3', '02-01-19', 'Fechada']]
and wanted to check if the 2 field of the list that is inside another list is="Open" if it will show all that are equal
My output so far has been
[['pedrito', '02-01-19', 'Aberta'], ['pedrito', '02-01-19', 'Aberta'], ['pedrito', '02-01-19', 'Fechada']]
But it should be
[['pedrito', '02-01-19', 'Aberta'], ['pedrito', '02-01-19', 'Aberta']]