Answer the question
In order to leave comments, you need to log in
How to write data to csv file?
Hello guys!
Could you help me write a script that opens a csv file, selects the 28th column and splits all the characters from the link from ? with a split. I made a small script, it shows what I want to do, but how to write a new modified file?
import csv
with open('simple.csv', 'r') as f:
incl_col = [28]
new_csv = []
reader = csv.reader(f, delimiter=";")
for row in reader:
col = str(list(row[i] for i in incl_col))
col = col.split('?')[0]
print(col)
new_csv.append(col)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question