Python Practice Example 9

Python 100例Python 100 Examples

Problem:Pause output for one second.

Program analysis:Use the sleep() function of the time module.

Program source code:

Example

#!/usr/bin/python # -*- coding: UTF-8 -*- import time myD = {1: 'a', 2: 'b'} for key, value in dict.items(myD): print (key, value) time.sleep(1) # Pause for 1 second

The output result of the above example is (there will be a pause effect):

1 a
2 b

Python 100例Python 100 Examples

Other Extensions