Question: I am trying to write basic PYTHON code, I am having trouble tripling a read value from a .csv file. Here is a part of
I am trying to write basic PYTHON code, I am having trouble tripling a read value from a .csv file. Here is a part of my code:
import csv sf = open('s.csv') # open s.csv file sr = csv.reader(sf) # read each row of sFile sd = list(sr) # assign the list of lists from sReader print(sd) s1 = sd[0] * 3 s2 = sd[1] * 3 s3 = sd[2] * 3 print(s1,s2,s3) This results in just getting the three values repeated three times instead of tripling it. Any help is much appreciated.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
