Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with csv
#3
(Mar-18-2021, 03:02 AM)Larz60+ Wrote: There are a couple of possibilities here.
Does your csv file have a header? If not, you cannot use DictReader
I think that your print function is never reached.
Add immediately after line3:
print(f"csv file contains {len(list(reader))}")
run it and see how many records are found.


Can i have a function that writes the header at the beggining of the program? or every time i add a new dict i need to write the headers?
Reply


Messages In This Thread
Problem with csv - by giorgosmarga - Mar-17-2021, 09:52 PM
RE: Problem with csv - by Larz60+ - Mar-18-2021, 03:02 AM
RE: Problem with csv - by giorgosmarga - Mar-18-2021, 09:34 AM
RE: Problem with csv - by Larz60+ - Mar-18-2021, 10:11 AM
RE: Problem with csv - by giorgosmarga - Mar-18-2021, 11:07 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020