Reputation: 21
I have a question related to the saving an array(.npy).
I have a computation that produces a new array for every loop. Once a while (let's say every 10 steps) I would like to save my output into .npy with a specific name, let's say result_at_step_10.npy. Of course at steps 20, the file name should be result_at_step_20.npy how could I do that in python?
Upvotes: 2
Views: 220
Reputation: 802
If renaming the file is what your are looking for, here is the code
import os
os.rename("old_name","new_name")
Upvotes: 2