So I have some user inputs, which I saved in lists and then wrote into a text file line by line like this:
txtfile1 = open("Input progression data.txt", "w+")
txtfile1.write(', '.join([str(item) for item in prog_input]) + '\n')
txtfile1.write(', '.join([str(item) for item in progmt_input]) + '\n')
txtfile1.write(', '.join([str(item) for item in mt_input]) + '\n')
txtfile1.write(', '.join([str(item) for item in ex_input]) + '\n')
txtfile1.close()
I also have this list:
result1 = ["Progress", "Progress(MT)", "ModuleRT", "Exclude"]
I am trying to print each item from result1
followed by the corresponding line from my text file. The output should look like this:
Progress: 120, 0, 0
Progress(MT): 100, 0, 20
ModuleRT: 80, 20, 20
ModuleRT: 60, 0, 60
Exclude: 40, 0, 80
This is what I have so far, it only printthe list items in order:
def c(list1):
for i in range (len(list1)):
print(list1[i], ":" ,end="" )
with open("Input progression data.txt") as file:
for item in file:
print(item+ '\n')
c(result1)