Python 我想重复我的代码x的时间量我应该怎么做?
使用功能Python 我想重复我的代码x的时间量我应该怎么做?,python,Python,使用功能范围(3000)。它返回一个包含从1到3000的所有数字的列表。该列表可用于以下for语句:用于范围(3000)内的索引:…这将适用于您 import time import ctypes for count in (3000): def Mbox(title, text, style): return ctypes.windll.user32.MessageBoxW(0, text, title, style) Mbox('Virus detected', '
范围(3000)
。它返回一个包含从1到3000的所有数字的列表。该列表可用于以下for语句:用于范围(3000)内的索引:…
这将适用于您
import time
import ctypes
for count in (3000):
def Mbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
Mbox('Virus detected', 'Would you like to run your anti-viruse software?',6)
定义一次并执行x次。将函数定义移到for循环之外,并仅使用
Mbox()
循环计数。在(3000)范围内的计数也使用
notin(3000)
可能x
是3000,代码是Mbo(..
给定的代码没有意义,为什么在for循环中定义一个函数,然后从外部调用该函数?
import time
import ctypes
def Mbox(title, text, style):
return ctypes.windll.user32.MessageBoxW(0, text, title, style)
for count in range(3000):
print(Mbox('Virus detected', 'Would you like to run your anti-viruse software?',6))