Hi All, I am trying to automate the test which I have to run 100 times by changing the data that read from csv file. I have a csv file called test-100.csv which contains 100 columns and about 2000 rows per column. My purpose is that read the data from each column in every execution of python script and save the output to different csv file name. Now I have finished for reading first column of csv file and then save it into test-automate.csv. How can I automatically run the python script by changing this line[line.split(',')[0] for line in f] into [line.split(',')[1] for line in f] and up to [line.split(',')[99] for line in f] and also file name into different file names without manually editing? Thanks for your help.
import csv import sys filename = open('test-automate.csv', 'w') sys.stdout = filename with open('test-100.csv') as f: firstColumn = [line.split(',')[0] 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__ with open('test-automate.csv') as file: data = file.read() print(data)