import time
def show_progress_bar(progress):
bar_length = 30
filled_length = int(bar_length * progress)
bar = '|' * filled_length + '-' * (bar_length - filled_length)
percentage = int(progress * 100)
print(f'\r[{bar}] {percentage}% ', end='', flush=True)
# 模拟进度更新
for i in range(101):
progress = i / 100
show_progress_bar(progress)
time.sleep(0.1)
print('\n进度完成!')
