In the programming below (sorry for the scribbling)
n1 = 1
when np.savetxt("data-1(value of n1).csv", data_del, delimiter=",")
n1 = 2
when np.savetxt("data-2.csv", data_del, delimiter=",")
I've repeatedly manually re-run it to n1=1-10, but I want to automate it.
Is there a way to make it possible?python
There are several ways to assemble a string containing variable values, so you can use whatever you want.
There are many other ways.
At the same time, if you've really rewritten
n1 and the filename up to 1-10, you can put them in a
for loop or function them all in one run.
The idea of a simple
for loop is as follows:
range(1,11) specifies a range of numbers to loop in variables starting with
1 and up to one before
np.savetxt with variables specified in the filename should also be included in the repeat process, so the following is true:
© 2023 OneMinuteCode. All rights reserved.