I am trying to change the format of dates from 30-Jan-02
to 30.Jan.2002
occurring in second position in a csv file using python.
I tried several things but I am confused with strings and bytes comptability.
import os
import csv
from datetime import datetime
import sys
from tempfile import NamedTemporaryFile
with open("Filenamecsv",'r') as csvfile, NamedTemporaryFile(dir="path/parh",delete=False) as temp:
w = csv.writer(temp)
r = csv.reader(csvfile)
for row in r:
dt = row[2].split("-")
row[2] = "{}.{}.{}".format(row[-1],row[1],row[0])
w.writerow(row)
move(temp.name,"Filename.csv")