for i in range(1, 27):
temp=str(i)
print '%s'(temp.zfill(3))
Traceback (most recent call last):
File "<ipython console>", line 3, in <module>
TypeError: 'str' object is not callable
調用我不知道爲什麼'海峽' 對象是不是在我的自行車
爲我所要的輸出是這樣的:
001
002
..
021
。 ..
所以我用zfill
。 但python告訴我它是「str
對象不可調用」 如何解決?
順便說一句,你可以簡單地'打印「%03D」%i',避免' temp'。 – 2013-03-21 09:37:45