HEX
Server: LiteSpeed
System: Linux CentOS-79-64-minimal 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: vishn3436 (5293)
PHP: 8.0.15
Disabled: NONE
Upload Files
File: //scripts/script-server/samples/scripts/bash_formatting.py
#!/usr/bin/python3

import time

lines_count = 10000
total_bytes = 130480561
progress_max_width = 24

print('Print some progress bar')
print('With %d lines in total' % (lines_count))
print('\n')

for i in range(0, lines_count):
    width = int(i * progress_max_width / lines_count)
    progress = '|' + ('=' * width) + '>' + (' ' * (progress_max_width - width)) + '|'

    bytes = i * total_bytes / lines_count
    bytes_percent = float(i * 100) / lines_count
    print("%s Got %d bytes of %d (%.2f%%)\r" % (progress, bytes, total_bytes, bytes_percent), end='')
    time.sleep(0.001)