为什么这个python代码的执行时间会增加每个调用?

Imr*_*fin -1 python performance time

import time
word = {"success":0, "desire":0, "effort":0, ...}
def cleaner(x):
    dust = ",./<>?;''[]{}\=+_)(*&^%$#@!`~"
    for letter in x:
        if letter in dust:
            x = x[0:x.index(letter)]+x[x.index(letter)+1:]
        else:
            pass
    return x #alhamdlillah it worked 31.07.12
print "input text to analyze"
itext = cleaner(raw_input()).split()
t = time.clock()
for iword in itext:
    if iword in word:
        word[iword] += 1
    else:
        pass
print t
print len(itext)
Run Code Online (Sandbox Code Playgroud)

每次我调用代码,t都会增加.任何人都可以解释这背后的基本概念/原因.也许在系统过程方面?非常感谢,编程小伙子们.

Aes*_*ete 10

因为每次运行脚本时都会打印出当前时间

这就是时间的作用,它不断前进.

  • 用于发现秘密的+1("_时间是如何工作的,它会不断前进.");) (4认同)