The quantity A is constantly updated. I want to write all the values of A to a .txt file and not just the last value. A=120,100,10 where 120 is the value in the first iteration and 10 is the value in the last iteration.
with open('Data_A.txt', 'w') as f:
writer = csv.writer(f)
A=10
print(A)
f.writelines('A'+ '\n')
f.write(str(A))
The current output is
A
10
The expected output is
A
120
100
10