Python Practice Example 10

Python 100例Python 100 Examples

Problem:Pause output for one second, and format the current time.

Program analysis:None.

Program source code:

Example

#!/usr/bin/python # -*- coding: UTF-8 -*- import time print (time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))) # Pause for one second time.sleep(1) print (time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))

The output result of the above example is:

2015-10-21 17:48:40
2015-10-21 17:48:41

Python 100例Python 100 Examples

Other extensions