I currently have a csv file containing a column of dates that is formatted as dd/mm/yyyy but i want to change it to yyyy/mm/dd
I have written the code below:
import csv
csv_in = open('news.csv','rb')
for rows in csv.reader(csv_in):
value = rows[0]
day= value[:2]
year= value[-4:]
month= value[3:5]
edited = year +'/'+month+'/'+day
rows[0] = edited
writer =csv.writer(open('newsedit.csv', 'wb'))
writer.writerow(rows)
for some reason the code above will only write one row and stop and i can't seem to figure out why this is happening.