0
I will create a CSV of 1,341 lines (with header). In Python 3 I used csv commands, but the file created has 1,282 lines
The line data is extracted from 1,340 Pdfs, from the metadata. I created a list and print to check, it is extracting everything right
The code of the CSV:
import csv
conjunto = open('emendas_autores.csv', mode='w', encoding='latin_1')
resultado = csv.DictWriter(conjunto, fieldnames=["Arquivo", "Autor", "Assunto", "Data_Criacao", "Data_Moficacao"])
resultado.writeheader()
def salva_csv():
print("+")
print (arquivo)
print (author)
print (subject)
print (creation_date)
print(mod_date)
print("+")
resultado.writerow({'Arquivo': arquivo,
'Autor': author,
'Assunto': subject,
'Data_Criacao': creation_date,
'Data_Moficacao': mod_date})
return
Then goes the iteration that extracts the data from the Pdfs and calls the function salva_csv()
and each file
Please would anyone know what might be wrong to stop at 1,282 lines? There is size limit on the writerow of csv?
Thank you! But in my case it is the 'amendments.csv' that is being created with less lines, it is he that I need to create complete before
– Reinaldo Chaves
with consegui: header = True with open('amendments.csv', 'a') as f: Writer = csv.Writer(f) # if we need to save the header... if header is True: # we write the header Writer.writerow(tabela_final[0]) # we mark that we no longer need to save the header header = False # we save the rest of the lines in CSV Writer.writerows(endtable[1:])
– Reinaldo Chaves