所以在 Python 中使用 time.sleep() 时我有一个非常奇怪的错误。
start = time.time()
# some code goes here
end = time.time()
spent = end - start
time.sleep(1.0101 - spent) # this gives a strange IOError...
Run Code Online (Sandbox Code Playgroud)
我可以修吗?我无法更改已用或 1.0101。
编辑:错误是:IOError: [Errno 22] 无效参数。
EDIT2:我使用的是 Raspberry Pi 2。