Oct-02-2019, 01:34 PM
I guess I solved my problem.
Here is the script:
Here is the script:
with open('file.txt',"r") as in_file, open('file2.txt',"w") as out_file: next(in_file) for line in in_file: line = line.strip() num1, num2 = line.split(',') num1, num2 = int(num1), int(num2) num3 = num1 + num2 out_file.write(str(num1) + "," + str(num2) + "," + str(num3) + "\n") continueWhich outputs external file "file2.txt", although without headers that I removed using command "next(in_file)"
Output:324,234,558
346,341,687
147,346,493
234,567,801
368,405,773
344,643,987
235,235,470
236,567,803