0
我有一段代码,其中有几个循环。通过检查条件(使用if语句)我想从除最后一个之外的所有循环中出来。有没有办法做到这一点,而无需修改我的代码,因为我没有多少时间来提交它。打破了for循环的混合物,如果条件
for file in dirs:
....
....
#Opens a file in the directory
with open(path, 'rU') as csvfile:
....
....
....
#Iterates over every row in the File
for row in csvreader:
...
#If the data is insufficient, the next row will be iterated.
if len(Parameters)>15:
#If this condition is not satisfied then I need to go to the next iteration of the first 'for' loop
#Without Calculating the Average_Slip
....
....
Calculation_of_Slip()
#Because when all the rows are done iterating, Average_Slip encounters an error as the input values depend on the Slip.
#Instead I need to go to the next file in the directory
Average_slip(Slip_3MW,Slip_7MW,Slip_9MW,Counter_1, Counter_2, Counter_3, Counter_4)
我确定我错过了一些非常简单的东西,但任何人都可以帮助我。