Python Exercise Example 10
**Question:** Pause for one second before output, and format the current time.
**Analysis:** None.
Program source code:
Example
#!/usr/bin/python
-- coding: UTF-8 --
import
time
(
time
.
strftime
(
'
%Y-%m-%d %H:%M:%S
'
,
time
.
localtime
(
time
.
time
(
)
)
)
)
Pause for one second
time
.
sleep
(
1
)
(
time
.
strftime
(
'
%Y-%m-%d %H:%M:%S
'
,
time
.
localtime
(
time
.
time
(
)
)
)
)
The output of the above example is:
2015-10-21 17:48:40
2015-10-21 17:48:41
Python 100 Examples