[Python] Python Download Script

Discussão em 'Python' iniciado por Stack, Maio 17, 2025.

  1. Stack

    Stack Membro Participativo

    When I run this, the Progress % is backwards, does anyone know how to make it 0% at the beginning and 100% when it completes?

    import time

    x = 25
    y = x
    t = 0

    downloading = True
    while downloading:
    time.sleep(1)
    t += 1
    x -= 1
    f = ((x/y) * 100)
    print('Time:', str(t) + ',', 'Progress: ', '{0:.2}'.format(str(f)) + '%,', 'Remaining: ' + str(x), 'MB', end="\r")

    if(x == 0):
    print('\nComplete!')
    break

    Continue reading...

Compartilhe esta Página