The python little progress bar

Need to use the module are: system and time

 

Import SYS
 # sys.stdout.write () stdout is the standard output (output to screen) 
Import SYS, Time 

for i in the Range (20 ): 
    sys.stdout.write ( " > " ) 
    sys.stdout.flush () # Real-Time to refresh the screen, the progress bar implementation. If this line comments, the screen will be a delay '>' characters all show 
    the time.sleep (0.5)     # with time.sleep () to achieve the progress bar output

 

Guess you like

Origin www.cnblogs.com/god-for-speed/p/10994466.html