Response to question: https://stackoverflow.com/questions/48605066/storing-new-data-of-list-into-the-text-file
The below code example demonstrates how to increment three variables 38 times and store the results in a text file. This is written in Python 3.6.
import os #declare empty list variable thirtyEightLoop = [] #Set initial value of there variables a = 1 b = 2 c = 3 #convert each variable to a string and concatenate them line = str(a) + " " + str(b) + " " + str(c) thirtyEightLoop.append(line) #print for validation of concatenated string print(line) #increment each variable by one and continue looping until c equals 38 while(c!=38): a+=1 b+=1 c+=1 line = str(a) + " " + str(b) + " " + str(c) print(line) thirtyEightLoop.append(line) #save file file = open("testfile.txt","w") #join list and split each row with a new line file.write('\n'.join(thirtyEightLoop)) #close the file file.close()