Data csv file into different text files with Python


#1

I'm a beginner in programming, but for a Dutch text categorization experiment I want to turn every instance (row) of a csv file into separate .txt files. The texts make up my dataset which has to be analyzed by a NLP tool. The csv looks like this.

Each instance has text in either the column 'Taaloefening1' or in the column 'Taaloefening2'. Now I need to save the text per instance in a .txt file and the name of the file needs to be the id and the label.
I was hoping I could do this automatically by programming a script in Python by using the csv module. I may have an idea about how to save the text into a .txt file, but I have no idea how to take the id and label, which match the text, as the file name.
Any ideas?


#2

What code do you have so far? You have a data sheet for us? Something to work with?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.