Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

writing data to CSV file  RSS feed

 
yekkala krishna
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My task is to write data to csv file after parsing data from Log file.

By using DataInputStream i am able to parse the data in the Log file and now how i can write parsed data to CSV file?
Please see the below code:


regards,
rama
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know what a CSV file looks like internally? If so, what would you have to do in order to create such a file?

Of course, if you have just a single value in each row, then there isn't much difference between a non.CSV text file and a CSV file.

Lastly, if the data that's supposed to go into the CSV gets more complicated, then you should consider using a library for creating such files - the format does get more complicated to generate if you can't make any assumptions about its contents. The AccessingFileFormats page links to several available CSV libraries.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!