Saturday 15 June 2013

time - Display a countdown for the python sleep function -


I am using time.sleep (10) in my program. When I run my program, can I display the countdown in shell?

  & gt; & Gt; Run_my_program () worked, now sleeping for 10 seconds   

and then I want to do it 10,9,8,7 ....

Is it possible?

You can always do this

  # print some content ' Worked, sleeping for 10 seconds now 'I am in xrange (10,0, -1) : Time.sleep (1) Print I   

This snippet has a little disturbing feature, which is printed on each line on a new line, 10,0, -1) for i

  Import Sims: time.sleep (1) sys.stdout.write (str (i) + '') Sys.stdout.flush ( )    

No comments:

Post a Comment