简体   繁体   English

如何避免在for循环中打印注释掉的代码

[英]How to avoid printing commented out code in for loop

If I run this loop, A will print 10 times.如果我运行这个循环, A将打印 10 次。

for i in range(10):
   """
   A
   """
   pass

How do I stop this?我该如何阻止这个?

在此处输入图像描述

I run this code in the python idle shell and got the same output.我在 python 空闲 shell 中运行此代码并得到相同的 output。 But when i run it in a file it stops printing this.但是当我在文件中运行它时,它会停止打印。 So try running it in a file , not in command prompt or the idle shell所以尝试在文件中运行它,而不是在命令提示符或空闲 shell

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

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