不能同时使用吗?
from datetime import datetime, dateimport datetime
不能同时使用吗?
程序代码:
import time from datetime import datetime, date import datetime localtime = time.localtime() time_1 = time.strftime("%H:%M:%S", localtime) time_2 = '09:05:00' time_1_struct = datetime.strptime(time_1, "%H:%M:%S") time_2_struct = datetime.strptime(time_2, "%H:%M:%S") seconds = (time_2_struct - time_1_struct).seconds print('等待:'+ str(seconds)) time.sleep(seconds) d = datetime.datetime.now() ca=(d+datetime.timedelta(days=8)).strftime('%#m/%#d') dooy= str(ca) print(dooy)