I am processing a CSV file. So the format in my CSV file is: 2020-10-26T03:45:00Z
(example).
How do I read this format to process the entire Excel sheet?
for eg: for a date, we can time = datetime.strptimerow[0],'%Y/%d/%m')
How can I use it similarly for my given format?
here is the snippet:
with open('nifty.csv') as database:
file = open('nifty.csv', newline='')
reader = csv.reader(file)
header = next(reader)
data = []
for row in reader:
# row = [time,open,high,low,close]
time = datetime.strptime(row[0],'%Y-%d-%m') ##here is where i get
stuck coz i need the right format according to the example given
above.##
open_price = float(row[1])
high = float(row[2])
low = float(row[3])
close = float(row[4])
format required
2020-10-26T03:45:00Z
year,month,day,hour,minutes,zone
question from:
https://stackoverflow.com/questions/65881405/datetime-format-for-processing-a-csv-file 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…