擅长:python、mysql、java
<p>您可以使用<a href="http://docs.python.org/library/time.html#time.time" rel="nofollow noreferrer">the ^{<cd1>} method</a>:</p>
<pre><code>import time
endtime = time.time() + 60
while time.time() < endtime:
# do something
</code></pre>
<p>注意-您可能不想使用<code>time.clock()</code>作为<a href="https://stackoverflow.com/questions/85451/python-time-clock-vs-time-time-accuracy">this measures CPU time rather than wall time</a>。</p>