[Python] [13] [demo experimental practice examples] [pause] 1s output

Original title:

1s pause output

 

Use time module:

>>> dir(time)
['_STRUCT_TM_ITEMS', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'altzone', 'asctime', 'clock', 'ctime', 'daylight', 'get_clock_info', 'gmtime', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'perf_counter', 'perf_counter_ns', 'process_time', 'process_time_ns', 'sleep', 'strftime', 'strptime', 'struct_time', 'thread_time', 'thread_time_ns', 'time', 'time_ns', 'timezone', 'tzname']
>>> 

 

 

Source:

# ! / Usr / bin / Python 
# encoding = UTF-. 8 
# - * - Coding: UTF-. 8 - * - 

# pause 1s output this question achieve an even interval 2s output, easy to observe the output results 

Import Time 

for I in Range (10 ):
     Print (I)
     IF I% 2 == 0: 
        the time.sleep ( 2)

 

Original answer given by:

 

 

 


-------- (I am dividing line) --------

reference:

1. RUNOOB.COM:https://www.runoob.com/python/python-exercise-example9.html

 

 

Remarks:

Initial modified: September 24, 2019 20:07:30

Environment: Windows 7 / Python 3.7.2

 

Guess you like

Origin www.cnblogs.com/kaixin2018/p/11580664.html