我有一个有几个函数的代码,代码的迭代次数是10次
def vectfit_auto(f, s, n_poles=5, n_iter=10,loss_ratio=1e-2, rcond=-1,):
for _ in range(n_iter):
poles, Zeros, H = vectfit_step(f, s, poles)
poles_list.append(poles)
我想在vectfit_step
(我的一个函数)中添加一些行,如下所示进行修改:
from iteration number of 5 to 10
do something
我希望代码像以前一样运行,并且我的修改只能从迭代次数5一直应用到最后。 我该怎么做? 谢谢
如前所述,可以在循环中包含if语句,并且只在主循环运行一定次数后才让它运行
相关问题 更多 >
编程相关推荐