This is a procedural requirement
import time
length = 50 # Progress bar length
string1 = " Start the download "
print(string1.center(56, "=")) # take string1 centered , Then fill in =
for i in range(length + 1):
c = (i / length) * 100 # Progress bar
a = '*' * i # fill *
b = '.' * (length - i) # fill .
print("\r{:3.0f}%[{}->{}]".format(c, a, b), end="") # \r enter , Return the cursor to the beginning of the line
time.sleep(0.08) # Pause the program for a given number of seconds
string2 = " Download complete "
print("\n" + string2.center(56, "="))
This is the program code
This is the running process
This is the result of the operation