Well, I'm still new to python and I'm a little bit confused of my task right now. I have some Objects given (the amount could be up to 100), and I need to calculate some things for them and save the results in different .txt-files. I did the task only for one Object:
Object = [1., 0., -1.]
repeated_given_time, repeated_given_space, calculated_time_and_space = [], [], []
results = open('Object.txt', 'a')
(here is some omitted code which reads the data from a file (this file remains the only, independent of amount of Objects) and puts the data into repeated_given_time
and repeated_given_space
)
unique = set(repeated_given_time)
(some other omitted code for calculating and putting some values in the calculated_time_and_space
)
time_list = list(unique)
for i in range (len(time_list)):
print (time_list[i], calculated_time_and_space[i], file = results)
And I have absolutely no idea, how to do these things for multiple Objects in a loop. Obviuosly, I have to create much more of these lists repeated_given_time_N, repeated_given_space_N, calculated_time_and_space_N
where N take values from 1 to N = 100 for 100 different Objects.
I know how to create multiple lists, but I couldn't find the efficient method of naming them.
The same thing with creating of multiple .txt's. How can I define their names like Object_N.txt
with N from 1 to 100?
It would be great if someone can help me with that.