Python當中輸出當前時間

代碼:

import time
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))

例如:

#coding=utf-8

import time

print("打卡開始")
count = 1 #定義一個整數,表示讀取該用戶的次數
while count < 9:
    count = int(input("請輸入你的序號:"))
    if count == 3 or count == 4:
        continue
    print("第",count,"個小天使報道:","打卡時間爲",time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
    count =count + 1

print("打卡結束")

執行結果爲
在這裏插入圖片描述
哈哈哈哈哈希望對你有用!!!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章