0
I have a database with over a thousand opinions (text) in a csv file, however I need only texts that contain more than 5 words to stay in my file. The problem is to make a code that goes through the entire document line by line and leaves only opinions that is more than 5 words, I have already researched some libraries and did not succeed in this implementation.
I’m using this code to read the file:
import csv
lines = []
finalLines = []
with open('aborto.csv') as csvfile:
readerCSV = csv.reader(csvfile, delimiter=',')
print(readerCSV)
for row in readerCSV:
print(row)
What is the organization of the file? Each line is an opinion? What if there are commas within the text?
– Woss
Exactly this my problem, as commas are delimiters I’m confused how to proceed with code.
– Rivaldo Hater
Okay, but did you create a CSV, which uses the comma as the delimiter, to store comma-bearing texts? Have to [Edit] the question and add a snippet from your CSV file?
– Woss
I added a photo of the terminal when I run my code
– Rivaldo Hater
I think you got it wrong. Add an excerpt from the file CSV which will be read by Python.
– Woss
See if it’s correct.
– Rivaldo Hater