good evening, I have a problem is that I have to make 2 python files where TestFiltrador filters the columns of a .csv file and that has 2 columns exactly) and the other called: Testdefiltrado prints those 2 columns but I get this error.
TestFiltraor:
Almacenamiento_de_datos = namedtuple('DESAPARECIDOS_INDIA_2018_2020','Tipo_de_sangre,Nombres,Genero,Cuerpo,Distrito,'
#where are the columns CSV FILE
'DENUNCIADO,Estatura,Edad,Cuando_Desparecio')
def Archivo_Csv(Archivo):
with open(Archivo, encoding = 'utf-8') as f:
lineador = csv.reader(f, delimiter=";")
next(lineador)
lista =[(Almacenamiento_de_datos(Tipo_de_sangre, Nombres, Genero, Cuerpo, Distrito, DENUNCIADO, float(Estatura), int(Edad),
Cuando_Desparecio)for Tipo_de_sangre, Nombres, Genero, Cuerpo, Distrito,DENUNCIADO,
Estatura, Edad, Cuando_Desparecio in lineador)]
return lista
#open the csv file and access it to
Storage which is namedtuple save it in the variable l i s t a
def Todos_Los_nombres (lista):
for i in lista:
Nom = next(i['Nombres'], i ['Edad'])
return Nom
#en list iterate and find me the columns EN: h o m b r e s, (int) E d a d
this would be the code to call it
def TestFiltrador (Desaparecidoscsv):
Nom= Todos_Los_nombres(Desaparecidoscsv)
print("Los nombres y sus edad son : ",Nom)
## Nom : iterates the first code above and prints
is this error
Nom = next(i['Nombres'], i ['Edad'])
TypeError: 'generator' object is not subscriptable
how can i do ? i hope they can helpe me , thank for see my question