我有一個使用一個簡單的while循環顯示進度條,但似乎並不奏效,因爲我預料的腳本:幫助與Python while循環行爲
count = 1
maxrecords = len(international)
p = ProgressBar("Blue")
t = time
while count < maxrecords:
print 'Processing %d of %d' % (count, maxrecords)
percent = float(count)/float(maxrecords) * 100
p.render(int(percent))
t.sleep(0.5)
count += 1
它出現在被循環「p.render ...」並且不返回到「打印」處理%d ...的%d ...'「。
更新:我的歉意。看起來ProgressBar.render()在呈現進度條時刪除了「print'Processing ...」的輸出。進度條是從http://nadiana.com/animated-terminal-progress-bar-in-python
你是說計數值沒有發生變化? – 2009-08-21 15:06:32