简体   繁体   English

如何在 Python 中重复一个动作

[英]How to repeat an action in Python

I want to repeat an action for n times.我想重复一个动作 n 次。 I've tried "if" but it does not work.我试过“如果”,但它不起作用。

If actiontimes == n:
    Print text*n

Thanks for any advice感谢您的任何建议

You have to write:你必须写:

for x in range(times):
    #action to repeat

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

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