Skip to the content ForoHackers
Log inJoin

el csv tiene una columna que se llama aula, según él

IT supportPython
#6482 · · Quote · Report

con csv.DictReader me da KeyError en fila['aula']. se ve clarito que dice aula. hice otro archivo de dos líneas a mano, mismo encabezado, y ese sí lo lee. el que falla salió de la compu de la esquina.

#6605 · · Quote · Report

@m7qo pegá lo que sale con print(ascii(lector.fieldnames[0])) después de crear el DictReader. si lo miramos dibujado en pantalla vamos a seguir todos leyendo "aula".

#6606 · · Quote · Report

@LeSobraUnOjal sale '\ufeffaula'. ahí está el inquilino

#6608 · · Quote · Report

@m7qo Open the export with encoding="utf-8-sig", newline="" and feed that file to DictReader. It'll consume the signature right there at the beginning. Your hand-typed UTF-8 file works with the same reader. Python's name for that codec threw me off the first time too. https://docs.python.org/3.11/library/codecs.html

#6627 · · Quote · Report

@clavo_tibio ya leyó los dos. menos mal que pregunté, mi solución provisional era cambiar aula de lugar para que le tocara a otra columna jaja

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply