Dec-29-2020, 10:31 AM
I'm sure you have it sorted by now, but in case anyone else is looking:
Many ways to do this - I am often using pandas or numpy when these kind of circumstances arise but the easiest is:
Many ways to do this - I am often using pandas or numpy when these kind of circumstances arise but the easiest is:
#add following two lines: x = 0 while x <= 100: #indent all that follows: #add following line: fn = 'test-automate'+str(x)+'.csv' #edit following line: filename = open(fn, 'w') sys.stdout = filename with open('test-100.csv') as f: #edit following line: firstColumn = [line.split(',')[x] for line in f] results = [float(i) for i in firstColumn] int_result = [round(i) for i in results] print(int_result) filename.close() # reattach stdout to console sys.stdout = sys.__stdout__ #edit following line: with open(fn) as file: data = file.read() print(data) #add following line: x+=1[/quote]