Verwenden Sie \ R, um eine Fortschrittsleiste zu überschreiben, die in Windows nicht funktioniertPython

Python-Programme
Anonymous
 Verwenden Sie \ R, um eine Fortschrittsleiste zu überschreiben, die in Windows nicht funktioniert

Post by Anonymous »

Ich habe diesen Codeausschnitt, der nicht funktioniert. Nun, es funktioniert gut, aber es löscht nicht auf meinem Windows -Computer. Bitte helfen Sie! < /P>

Code: Select all

import time
import sys

def loading_bar(count, total, suffix=''):
length = 60
endlength = int(round(length * count / float(total)))

percents = round(100.0 * count / float(total), 1)
bar = '=' * endlength + '-' * (length - endlength)

sys.stdout.write(f'[{bar}] {percents}% ...{suffix}\r')
sys.stdout.flush()

def loading():
items = list(range(0, 200))
total_items = len(items)
print("Loading:")
for i, item in enumerate(items):
time.sleep(0.1)
loading_bar(i + 1, total_items, suffix=str(item))
print()
print("Done!")
time.sleep(1)

loading()

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post