首页上一页 1 下一页尾页 1 条记录 1/1页
关于特价活动倒计时例子的提问
发表在Python图书答疑
2020-03-11
悬赏:1 学分
《Python从入门到项目实践》第3章 Python输入与输出 48页-48页
是否精华
是
否
版块置顶:
是
否
#*_*coding:UTF-8*_*
#开发工具:pycharm
#特价商品倒计时
import datetime
day20=datetime.datetime.strptime('2020-12-20 0:0:0','%Y-%m-%d%H:%M:%S')
now=datetime.datetime.today()
delta=day20-now
day=delta.days
hour=int(delta.seconds/60/60)
minutes=int((delta.seconds-hour*60*60)/60)
seconds=delta.seconds-hour*60*60-minutes*60
print('\033[31;43m距离结束:\033[43m'+'\033[34;43m'+str(day)+'\033[43m'+'\033[31;43m天
\033[43m'+'\033[34;43m'+str(hour)+'\033[43m'+'\033[31;43m小时
\033[43m'+'\033[34;43m'+str(minutes)+'\033[43m'+'\033[31;43m分钟
\033[43m'+'\033[34;43m'+str(seconds)+'\033[43m'+'\033[31;43m秒\033[0m')

购物车
发表新帖
立即签到








