第10天了,今天的題目跟009類似,都比較水,有時間的話再做一道~
鏈接:http://www.runoob.com/python/python-exercise-example10.html
題目:暫停一秒輸出,並格式化當前時間。
不會做,直接看答案:
import time print (time.strftime('%Y-%m-%d %H:%M:%S')) time.sleep(1) print (time.strftime('%Y-%m-%d %H:%M:%S'))
思考:
Python time strftime() 函數接收以時間元組,並返回以可讀字符串表示的當地時間,格式由參數format決定。
語法:time.strftime(format[, t])
