Python Forum
In CSV, how to write the header after writing the body?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In CSV, how to write the header after writing the body?
#7
Thank you all for your very helpful and informative responses.
Unfortunately, I'm still having the problem.

I cannot use regular text writing function write() because some of the data has "commas", which leads to misinterpretation by the CSV reader. That because I'm using csv package.

I would appreciate if you kindly lake a look at my code in GitHub repository in this link:

GitHub repository for converting .bib 2 CSV

Please Open "ReadingBib1.py"

Two problems I have in the resultant "ConferencePublication.csv" file:
  1. The file has to header. Header's content is in a "List variable" named: CSVHeader. It's printed at the end of the code in line no. 62.
  2. I do not know why I always get an empty line between the lines in "ConferencePublication.csv" file!

Please notice that the Python code write each line of CSV using the command:
CSVWriterPointer.writerow(CSVLineContent) 
in line no. 61

Thanks again for you all Heart ...
Reply


Messages In This Thread
RE: In CSV, how to write the header after writing the body? - by Tim - Jan-03-2018, 10:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [BeautifulSoup] Find </body>? Winfried 3 1,442 Jul-21-2023, 11:25 AM
Last Post: Gaurav_Kumar
  Get html body of URL rama27 6 3,569 Aug-03-2020, 02:37 PM
Last Post: snippsat
  malformed header from script 'main.py': Bad header: * Serving Flask app "main" anuragsapanbharat 2 4,596 Jun-12-2019, 07:26 AM
Last Post: anuragsapanbharat
  Is it possible to perform a PUT request by passing a req body instead of an ID ary 0 1,869 Feb-20-2019, 05:55 AM
Last Post: ary

Forum Jump:

User Panel Messages

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