简体   繁体   English

调试时如何查看for循环中每个迭代/步骤的输出

[英]how to see the output for each iteration/step in for loop when debugging

I have a nested for loop in which I need to see the output at each iteration for debugging purposes.我有一个嵌套的 for 循环,我需要在每次迭代中查看输出以进行调试。 How can I achieve this?我怎样才能做到这一点?

Here is the example code for which I need to see what the output is.这是我需要查看输出内容的示例代码。

for sheet_name, df in Input_Data.items():
    for line in df:
        if line.startswith('Linear'):
            index = line.index('Linear')
            break

try this:尝试这个:

for sheet_name, df in Input_Data.items():
    for line in df:

        print(line) # just print the line

        if line.startswith('Linear'):
            index = line.index('Linear')      

            break

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM