Reputation: 380
I'm looking to create a new .csv file using python and then write to the file after that. I couldn't find a command to create a new file using the CSV library. I thought something like
NewFile = csv.creatfile(PATH)
might exist but I couldn't find something like that.
Thank you in advance! Happy to answer any questions you may have!
Upvotes: 0
Views: 227
Reputation: 2915
The csv
module doesn't handle file creation; Python handles file creation as a builtin function called open
-- once you have a file handle created using open
, you can use it with csv.writer
or csv.DictWriter
to write data to the file.
Upvotes: 3