摘要: 例如,我需要答应100行hello world,很简单的方法,就是 s = "hello world\n" print s*100当然有时候,不可能这么简单 s = "hello world\n" for i in xrange(100): #do something s += s如果你这么去做了,后果就只有一个,死机先看一个我测试的列子吧 import time a = 'a'*10 b = time.time() for i in range(26): a += a print time.time()-b #大约花掉35s时间花掉35 阅读全文