功能不循环所需的次数

时间:2016-05-18 00:19:21

标签: python loops python-3.x win32com

在我编写的代码中,有一个名为SignA的变量。根据此值,循环需要重复一定次数。在这个例子中,假设SignA为3,因此内部内容需要循环三次。

以下是代码:

 if (signA > 0):
    count = 0
    for iterate in range(signA):
        count=count + 1
        #ws.Cells(row_origin, column_origin).Value = "Created " + str(signA) + " Sign A signs"
        # The index pertains to the index location of the element in the list
        # the 'n' represents the actual name of the header attribute
        #for test in range(signA):
        repeated = 0
        for index, n in enumerate(header):
            rowDictionary[n] = row[index+3]
            ws.Cells(row_origin, column_origin).Value = rowDictionary[n]


            column_origin += 1
            print("The value of signa is: " + str(signA))
            repeated+=1
        print("Loop has repeated {} times".format(str(repeated)))
        print("count (this increments to the sign num value): " + str(count))
        #print("The row_origin is: " + str(row_origin) + " and the column_origin is: " + str(column_origin))
        #row_origin = row_origin + 1
        #resetRowDictionaryionary()
    print("Ending row loop now. This is printed once the whole sign num loops are done")

我需要行的内部循环“for index,n in enumerate(header):”重复3次,但它似乎只重复一次然后根本不打印任何东西。

有人可以看看我的代码。

谢谢!

0 个答案:

没有答案