【发布时间】:2019-11-03 09:27:03
【问题描述】:
我想每隔 __ 秒调用一次 printFunction 方法,但我想在调用一定次数后停止调度。例如,每 5 秒打印 10 次。从另一个文件中提取这些频率和运行时间值。
在 PyCharm 中运行。
进口时间表 进口时间
类示例:
# basic function to print
def printFunction(self):
print("Hello world")
def repeated(self):
# reads in two values from another file
systemFrequency = float(freqSettings.systemFrequency)
systemRunTime = int(freqSettings.systemRunTime)
global count
count = 0
while (count < systemRunTime):
self.printFunction
self.increaseCount
def increaseCount(self):
global count
count += 1
【问题讨论】:
-
问题是......?
-
当前调用 self 会立即打印“hello world”__ 次,而不是等待一定的秒数