乐于分享
好东西不私藏

第9课:时间小管家——让电脑告诉你时间

第9课:时间小管家——让电脑告诉你时间

🎯 本课目标

  • 学习使用datetime模块获取和处理时间
  • 掌握各种时间格式的显示方法
  • 学会计算时间差和进行时间转换
  • 制作倒计时器和计时器程序
  • 创建智能日程提醒系统
  • 综合应用前8课知识解决时间相关问题

⏰ 趣味引入:时间是什么?

小实验:请回答以下问题,不要看钟表!

  1. 现在大概是几点?
  2. 今天星期几?
  3. 这个月有多少天?

你发现了什么?人脑能大概知道时间,但不精确。而计算机是时间管理大师,它能精确到百万分之一秒!

时间的秘密

  • 计算机内部用数字表示时间
  • 从1970年1月1日开始计时(UNIX时间戳)
  • 每过1秒,数字就加1
  • 全世界用统一的时间标准(UTC)

今天,让我们教计算机成为你的时间小管家


🕰️ 第一部分:认识datetime模块

导入datetime模块

# 导入datetime模块
import datetime

print("datetime模块已就绪!")
print("现在可以处理时间了!")

获取当前时间

import datetime

# 获取当前日期和时间
now = datetime.datetime.now()
print("当前完整时间:", now)
print(f"类型:{type(now)}")

# 获取当前日期
today = datetime.date.today()
print("当前日期:", today)

# 获取当前时间
current_time = datetime.datetime.now().time()
print("当前时间:", current_time)

📅 第二部分:时间的各个部分

拆分时间的各个部分

import datetime

# 获取当前时间
now = datetime.datetime.now()

print("🔍 时间的各个部分:")
print("=" * 30)

# 拆解时间
print(f"年份:{now.year}年")
print(f"月份:{now.month}月")
print(f"日期:{now.day}日")
print(f"小时:{now.hour}时")
print(f"分钟:{now.minute}分")
print(f"秒:{now.second}秒")
print(f"微秒:{now.microsecond}微秒")
print(f"星期:星期{now.weekday() + 1}")  # weekday()返回0-6,0是周一

# 判断上午/下午
if now.hour < 12:
    am_pm = "上午"
elif now.hour < 18:
    am_pm = "下午"
else:
    am_pm = "晚上"

print(f"现在是{am_pm}")

练习1:智能问候程序

# 智能问候程序
import datetime

print("🤖 智能问候程序")
print("=" * 20)

# 获取当前时间
now = datetime.datetime.now()
hour = now.hour
minute = now.minute

# 获取用户名字
name = input("你叫什么名字?")

# 根据时间问候
if5 <= hour < 12:
    greeting = "早上好"
elif12 <= hour < 14:
    greeting = "中午好"
elif14 <= hour < 18:
    greeting = "下午好"
elif18 <= hour < 22:
    greeting = "晚上好"
else:
    greeting = "夜深了"

print(f"{greeting}{name}!")
print(f"现在是{hour:02d}:{minute:02d}")

# 附加提醒
if hour < 6:
print("💤 天还没亮,再睡会儿吧!")
elif hour < 9:
print("🌅 美好的一天开始了!")
elif hour < 12:
print("📚 学习的好时光!")
elif hour < 14:
print("🍚 午饭时间到!")
elif hour < 17:
print("💪 下午继续加油!")
elif hour < 20:
print("🎮 放松一下,但别忘了作业!")
else:
print("🌙 该准备睡觉了!")

练习2:生日计算器

# 生日计算器
import datetime

print("🎂 生日计算器")
print("=" * 20)

# 获取当前日期
today = datetime.date.today()
print(f"今天是:{today}")

# 输入生日
birth_year = int(input("你的出生年份:"))
birth_month = int(input("你的出生月份:"))
birth_day = int(input("你的出生日期:"))

# 创建生日日期
birthday = datetime.date(birth_year, birth_month, birth_day)
print(f"你的生日是:{birthday}")

# 计算年龄
age = today.year - birthday.year

# 调整如果今年生日还没过
if (today.month, today.day) < (birthday.month, birthday.day):
    age -= 1

print(f"你现在{age}岁")

# 计算下一个生日
next_birthday = datetime.date(today.year, birth_month, birth_day)
if next_birthday < today:
    next_birthday = datetime.date(today.year + 1, birth_month, birth_day)

# 计算距离下一个生日的天数
days_to_birthday = (next_birthday - today).days

print(f"距离你的下一个生日还有{days_to_birthday}天")

# 计算是星期几
weekdays = ["星期一""星期二""星期三""星期四""星期五""星期六""星期日"]
birthday_weekday = weekdays[next_birthday.weekday()]
print(f"你的下一个生日是{birthday_weekday}")

🎨 第三部分:格式化时间显示

时间格式化方法

import datetime

now = datetime.datetime.now()

print("🕐 时间格式化展示")
print("=" * 30)

# 方法1:strftime 格式化
print("1. 基本格式:")
print(f"  年-月-日:{now.strftime('%Y-%m-%d')}")
print(f"  时:分:秒:{now.strftime('%H:%M:%S')}")
print(f"  完整时间:{now.strftime('%Y-%m-%d %H:%M:%S')}")

print("\n2. 中文格式:")
print(f"  {now.year}{now.month}{now.day}日")
print(f"  星期{now.weekday() + 1}")
print(f"  {now.hour:02d}{now.minute:02d}{now.second:02d}秒")

print("\n3. 12小时制:")
hour_12 = now.hour % 12
if hour_12 == 0:
    hour_12 = 12
am_pm = "上午"if now.hour < 12else"下午"
print(f"  {am_pm}{hour_12}:{now.minute:02d}")

print("\n4. 其他格式:")
print(f"  简写日期:{now.strftime('%y/%m/%d')}")  # 两位年份
print(f"  月份全名:{now.strftime('%B')}")
print(f"  月份简写:{now.strftime('%b')}")
print(f"  星期全名:{now.strftime('%A')}")
print(f"  星期简写:{now.strftime('%a')}")

# 格式化符号表
print("\n📋 常用格式化符号:")
format_codes = [
    ("%Y""四位年份(2023)"),
    ("%y""两位年份(23)"),
    ("%m""月份(01-12)"),
    ("%B""月份全名(January)"),
    ("%b""月份简写(Jan)"),
    ("%d""日期(01-31)"),
    ("%H""24小时制小时(00-23)"),
    ("%I""12小时制小时(01-12)"),
    ("%M""分钟(00-59)"),
    ("%S""秒(00-59)"),
    ("%p""上午/下午(AM/PM)"),
    ("%A""星期全名(Monday)"),
    ("%a""星期简写(Mon)"),
    ("%w""星期数字(0-6,0是周日)"),
]

for code, meaning in format_codes:
    result = now.strftime(code)
print(f"  {code:3} = {meaning:15} → 示例:{result}")

项目1:精美时钟

# 精美时钟程序
import datetime
import time
import os

print("🕐 精美时钟")
print("=" * 30)
print("按 Ctrl+C 停止")

try:
whileTrue:
# 清屏(不同系统命令不同)
        os.system('cls'if os.name == 'nt'else'clear')

# 获取当前时间
        now = datetime.datetime.now()

# 创建美观的时钟界面
print("\n" + "═" * 40)
print(" " * 15 + "🕐 数字时钟")
print("═" * 40)

# 显示日期
        date_str = now.strftime("%Y年%m月%d日")
        weekday_str = ["一""二""三""四""五""六""日"][now.weekday()]
print(f"📅 日期:{date_str} 星期{weekday_str}")

# 显示时间(大字体效果)
        time_str = now.strftime("%H:%M:%S")
print("\n" + " " * 12 + "╔══════════╗")
print(" " * 12 + f"║  {time_str}  ║")
print(" " * 12 + "╚══════════╝")

# 显示12小时制
        hour_12 = now.hour % 12
if hour_12 == 0:
            hour_12 = 12
        am_pm = "上午"if now.hour < 12else"下午"
print(f"⏰ 12小时制:{am_pm}{hour_12:02d}:{now.minute:02d}:{now.second:02d}")

# 显示秒的小数部分
print(f"⏱️  毫秒:{now.microsecond // 1000:03d}")

# 进度条显示一天进度
        total_seconds = now.hour * 3600 + now.minute * 60 + now.second
        day_progress = total_seconds / 86400
        bar_length = 30
        filled = int(bar_length * day_progress)
        bar = "█" * filled + "░" * (bar_length - filled)
print(f"📊 今天进度:[{bar}{day_progress*100:.1f}%")

# 问候语
if now.hour < 6:
            greeting = "🌙 夜深了,早点休息"
elif now.hour < 12:
            greeting = "🌅 早上好,新的一天开始了!"
elif now.hour < 14:
            greeting = "🍚 中午好,午饭时间到!"
elif now.hour < 18:
            greeting = "☀️ 下午好,继续加油!"
elif now.hour < 22:
            greeting = "🌆 晚上好,放松一下!"
else:
            greeting = "🌃 该准备睡觉了!"

print(f"\n💬 {greeting}")
print("═" * 40)

# 等待1秒
        time.sleep(1)

except KeyboardInterrupt:
print("\n⏹️ 时钟已停止")

⏱️ 第四部分:时间计算和比较

时间差计算

import datetime

print("⏱️ 时间差计算")
print("=" * 20)

# 创建两个时间
time1 = datetime.datetime(20231018300)  # 10月1日 8:30
time2 = datetime.datetime(2023101164530)  # 10月1日 16:45:30

print(f"时间1:{time1}")
print(f"时间2:{time2}")

# 计算时间差
time_diff = time2 - time1
print(f"\n时间差:{time_diff}")
print(f"总秒数:{time_diff.total_seconds()}秒")
print(f"总分钟数:{time_diff.total_seconds() / 60:.1f}分钟")
print(f"总小时数:{time_diff.total_seconds() / 3600:.2f}小时")

# 获取时间差的各个部分
print("\n🔍 详细时间差:")
print(f"天数:{time_diff.days}天")
print(f"秒数:{time_diff.seconds}秒")
print(f"微秒:{time_diff.microseconds}微秒")

# 计算时分秒
total_seconds = time_diff.total_seconds()
hours = int(total_seconds // 3600)
minutes = int((total_seconds % 3600) // 60)
seconds = int(total_seconds % 60)
print(f"分解为:{hours}小时{minutes}分钟{seconds}秒")

项目2:倒计时器

# 倒计时器
import datetime
import time

print("⏳ 倒计时器")
print("=" * 20)

# 选择倒计时类型
print("请选择倒计时类型:")
print("1. 特定日期倒计时(如生日、节日)")
print("2. 自定义时间倒计时(如考试、比赛)")
print("3. 简单时间倒计时(小时、分钟、秒)")

choice = input("\n你的选择(1-3):")

if choice == "1":
# 特定日期倒计时
print("\n🎯 特定日期倒计时")
    event_name = input("事件名称(如:生日、春节):")

    year = int(input("年份:"))
    month = int(input("月份:"))
    day = int(input("日期:"))

    target_date = datetime.datetime(year, month, day)

elif choice == "2":
# 自定义时间倒计时
print("\n🎯 自定义时间倒计时")
    event_name = input("事件名称:")

print("\n请输入目标时间:")
    year = int(input("年份:"))
    month = int(input("月份:"))
    day = int(input("日期:"))
    hour = int(input("小时(0-23):"))
    minute = int(input("分钟(0-59):"))

    target_date = datetime.datetime(year, month, day, hour, minute)

elif choice == "3":
# 简单倒计时
print("\n🎯 简单倒计时")
    event_name = input("事件名称:")

    hours = int(input("小时:"))
    minutes = int(input("分钟:"))
    seconds = int(input("秒:"))

# 计算目标时间(当前时间 + 倒计时时间)
    now = datetime.datetime.now()
    target_date = now + datetime.timedelta(hours=hours, minutes=minutes, seconds=seconds)

else:
print("❌ 无效选择,使用默认设置")
    event_name = "默认倒计时"
    target_date = datetime.datetime.now() + datetime.timedelta(hours=1)

print(f"\n⏰ 倒计时开始:{event_name}")
print(f"目标时间:{target_date.strftime('%Y-%m-%d %H:%M:%S')}")
print("\n按 Ctrl+C 停止倒计时")

try:
whileTrue:
# 获取当前时间
        now = datetime.datetime.now()

# 计算剩余时间
if now < target_date:
            time_left = target_date - now

# 计算各个部分
            days = time_left.days
            hours = time_left.seconds // 3600
            minutes = (time_left.seconds % 3600) // 60
            seconds = time_left.seconds % 60

# 显示倒计时
print(f"\r⏳ 剩余时间:{days}天 {hours:02d}:{minutes:02d}:{seconds:02d}", end="")

# 等待1秒
            time.sleep(1)
else:
print(f"\n\n🎉 时间到!{event_name}!")
print("🔔 倒计时结束!")
break

except KeyboardInterrupt:
print(f"\n\n⏹️ 倒计时已停止")

# 显示统计信息
now = datetime.datetime.now()
if now < target_date:
    time_passed = datetime.datetime.now() - (target_date - (target_date - now))
print(f"⏱️ 本次倒计时进行了:{time_passed}")
else:
    time_passed = target_date - (target_date - (datetime.datetime.now() - target_date))
print(f"⏱️ 倒计时准时结束")

项目3:学习计时器

# 学习计时器
import datetime
import time

print("📚 学习计时器")
print("=" * 20)
print("帮助你记录学习时间,科学安排休息")

# 学习任务
task = input("你要学习什么科目?")
study_time = int(input("计划学习多少分钟?"))
break_time = int(input("休息多少分钟?"))

print(f"\n⏰ 学习计划:")
print(f"科目:{task}")
print(f"学习:{study_time}分钟")
print(f"休息:{break_time}分钟")
print("=" * 20)

cycles = 0
total_study_time = 0
total_break_time = 0

try:
whileTrue:
        cycles += 1

# 学习阶段
print(f"\n🎯 第{cycles}轮学习开始!")
print(f"科目:{task}")
        study_end = datetime.datetime.now() + datetime.timedelta(minutes=study_time)

while datetime.datetime.now() < study_end:
            time_left = study_end - datetime.datetime.now()
            minutes = int(time_left.total_seconds() // 60)
            seconds = int(time_left.total_seconds() % 60)
print(f"\r📖 学习剩余:{minutes:02d}:{seconds:02d}", end="")
            time.sleep(1)

        total_study_time += study_time
print(f"\n\n✅ 学习完成!本轮学习了{study_time}分钟")

# 休息阶段
print(f"\n☕ 开始休息{break_time}分钟")
        break_end = datetime.datetime.now() + datetime.timedelta(minutes=break_time)

while datetime.datetime.now() < break_end:
            time_left = break_end - datetime.datetime.now()
            minutes = int(time_left.total_seconds() // 60)
            seconds = int(time_left.total_seconds() % 60)
print(f"\r🌴 休息剩余:{minutes:02d}:{seconds:02d}", end="")
            time.sleep(1)

        total_break_time += break_time
print(f"\n\n⏰ 休息结束!")

# 询问是否继续
print(f"\n📊 学习统计:")
print(f"  已完成{cycles}轮学习")
print(f"  总学习时间:{total_study_time}分钟")
print(f"  总休息时间:{total_break_time}分钟")

        continue_study = input("\n是否继续下一轮学习?(是/否)")
if continue_study.lower() != "是":
break

except KeyboardInterrupt:
print(f"\n\n⏹️ 学习计时已停止")

# 最终统计
print(f"\n{'='*30}")
print("📊 最终学习报告")
print("="*30)
print(f"学习科目:{task}")
print(f"完成轮数:{cycles}轮")
print(f"总学习时间:{total_study_time}分钟")
print(f"总休息时间:{total_break_time}分钟")
print(f"总时长:{total_study_time + total_break_time}分钟")

# 建议
if cycles >= 3:
print("\n💡 建议:你已经学习了很长时间,应该好好休息!")
elif total_study_time >= 60:
print("\n💡 建议:学习时间超过1小时,可以安排一次长休息!")
else:
print("\n💡 建议:保持良好的学习节奏!")

📅 第五部分:日程管理和提醒

项目4:智能课程表

# 智能课程表
import datetime

print("📅 智能课程表")
print("=" * 20)

# 定义课程表
schedule = {
0: ["语文""数学""英语""体育""美术"],  # 周一
1: ["数学""语文""科学""音乐""自习"],  # 周二
2: ["英语""数学""社会""体育""班会"],  # 周三
3: ["语文""英语""科学""美术""自习"],  # 周四
4: ["数学""语文""英语""音乐""大扫除"], # 周五
5: ["周末""周末""周末""周末""周末"],  # 周六
6: ["周末""周末""周末""周末""周末"],  # 周日
}

# 课程时间
class_times = [
"08:00-08:40",
"08:50-09:30"
"10:00-10:40",
"10:50-11:30",
"14:00-14:40"
]

# 获取当前时间
now = datetime.datetime.now()
weekday = now.weekday()  # 0=周一, 6=周日
current_time = now.time()

# 显示今日课表
print(f"今天是{now.strftime('%Y年%m月%d日')}")
weekdays = ["星期一""星期二""星期三""星期四""星期五""星期六""星期日"]
print(f"📅 {weekdays[weekday]} 课程表")

print("\n" + "="*30)
for i, (course, time_slot) inenumerate(zip(schedule[weekday], class_times), 1):
print(f"第{i}节 {time_slot:12}{course}")
print("="*30)

# 判断当前是什么课
if weekday >= 5:  # 周末
print("\n🎉 今天是周末!好好休息!")
else:
# 检查当前时间对应的课程
    current_class = None
    class_index = -1

# 定义课程时间段
    class_periods = [
        (datetime.time(80), datetime.time(840)),   # 第1节
        (datetime.time(850), datetime.time(930)),  # 第2节
        (datetime.time(100), datetime.time(1040)), # 第3节
        (datetime.time(1050), datetime.time(1130)),# 第4节
        (datetime.time(140), datetime.time(1440)), # 第5节
    ]

for i, (start, end) inenumerate(class_periods):
if start <= current_time <= end:
            current_class = schedule[weekday][i]
            class_index = i
break

if current_class:
print(f"\n⏰ 现在正在上:第{class_index+1}节 {current_class}")
print(f"  时间:{class_times[class_index]}")

# 计算距离下课还有多久
        end_time = class_periods[class_index][1]
        time_left = datetime.datetime.combine(datetime.date.today(), end_time) - now
        minutes_left = int(time_left.total_seconds() // 60)
        seconds_left = int(time_left.total_seconds() % 60)

if minutes_left > 0:
print(f"  ⏳ 距离下课还有:{minutes_left}分钟{seconds_left}秒")
else:
print(f"  ⏰ 快下课了!")
else:
# 判断是课前还是课后
if current_time < datetime.time(80):
print(f"\n🌅 还没开始上课,好好准备!")
elif current_time > datetime.time(1440):
print(f"\n🎉 今天的课程已全部结束!")
else:
# 判断是课间休息
print(f"\n☕ 现在是课间休息时间")

# 显示明日课表
print(f"\n📅 明日({weekdays[(weekday + 1) % 7]})课程:")
for i, (course, time_slot) inenumerate(zip(schedule[(weekday + 1) % 7], class_times), 1):
print(f"  第{i}节 {time_slot:12}{course}")

项目5:纪念日提醒器

# 纪念日提醒器
import datetime

print("🎈 纪念日提醒器")
print("=" * 20)

# 重要纪念日
important_dates = {
"春节": datetime.date(2023122),
"元宵节": datetime.date(202325),
"清明节": datetime.date(202345),
"劳动节": datetime.date(202351),
"儿童节": datetime.date(202361),
"端午节": datetime.date(2023622),
"中秋节": datetime.date(2023929),
"国庆节": datetime.date(2023101),
"元旦": datetime.date(202411),
}

# 添加个人纪念日
print("是否添加个人纪念日?")
add_personal = input("(输入'是'添加,其他键跳过):")

if add_personal.lower() == "是":
    num_personal = int(input("要添加几个纪念日?"))
for i inrange(num_personal):
print(f"\n添加第{i+1}个纪念日:")
        name = input("纪念日名称:")
        year = int(input("年份:"))
        month = int(input("月份:"))
        day = int(input("日期:"))

        important_dates[name] = datetime.date(year, month, day)

# 获取当前日期
today = datetime.date.today()
print(f"\n今天是:{today.strftime('%Y年%m月%d日')}")

# 检查纪念日
print("\n📅 即将到来的纪念日:")
print("="*40)

upcoming_dates = []
for name, date in important_dates.items():
# 计算距离纪念日的天数
    days_diff = (date - today).days

if -7 <= days_diff <= 30:  # 过去7天内到未来30天内
        upcoming_dates.append((name, date, days_diff))

# 按天数排序
upcoming_dates.sort(key=lambda x: x[2])

ifnot upcoming_dates:
print("近期没有重要纪念日")
else:
for name, date, days_diff in upcoming_dates:
        weekday = ["一""二""三""四""五""六""日"][date.weekday()]

if days_diff < 0:
print(f"📅 {name}{date.strftime('%m月%d日')} 星期{weekday}")
print(f"  已经过去{abs(days_diff)}天了")
elif days_diff == 0:
print(f"🎉 {name}:今天!")
print(f"  {date.strftime('%m月%d日')} 星期{weekday}")
elif days_diff == 1:
print(f"🎯 {name}:明天!")
print(f"  {date.strftime('%m月%d日')} 星期{weekday}")
elif days_diff <= 7:
print(f"⏰ {name}{days_diff}天后")
print(f"  {date.strftime('%m月%d日')} 星期{weekday}")
else:
print(f"📅 {name}{days_diff}天后")
print(f"  {date.strftime('%m月%d日')} 星期{weekday}")
print("-"*30)

# 最近的一个纪念日
if upcoming_dates and upcoming_dates[0][2] > 0:
    next_name, next_date, next_days = upcoming_dates[0]
print(f"\n🎯 下一个纪念日是:{next_name}")
print(f"⏰ 距离还有:{next_days}天")
print(f"📅 日期:{next_date.strftime('%Y年%m月%d日')}")

# 星期几
    weekdays = ["星期一""星期二""星期三""星期四""星期五""星期六""星期日"]
print(f"📅 星期:{weekdays[next_date.weekday()]}")

🎮 第六部分:时间相关游戏

游戏1:时间猜谜游戏

# 时间猜谜游戏
import datetime
import random

print("⏰ 时间猜谜游戏")
print("=" * 20)
print("测试你对时间的理解!")

score = 0
questions = 5

for q inrange(1, questions + 1):
print(f"\n第{q}题:")

# 随机生成一个时间
    random_hour = random.randint(023)
    random_minute = random.randint(059)
    random_time = datetime.time(random_hour, random_minute)

print(f"时间:{random_hour:02d}:{random_minute:02d}")

# 问题类型
    question_type = random.choice([
"am_pm",  # 判断上午下午
"quarter",  # 判断刻钟
"to_half",  # 差几分钟到整点/半点
"angle"# 时钟角度(简化)
    ])

if question_type == "am_pm":
# 判断上午下午
print("这个时间是上午还是下午?")
print("1. 上午")
print("2. 下午")

        correct = 1if random_hour < 12else2
try:
            answer = int(input("你的选择(1/2):"))
if answer == correct:
print("✅ 正确!")
                score += 1
else:
print(f"❌ 错误!{random_hour:02d}:{random_minute:02d}{'上午'if random_hour < 12else'下午'}")
except:
print("❌ 请输入1或2!")

elif question_type == "quarter":
# 判断刻钟
if random_minute < 15:
            quarter = "一刻"
elif random_minute < 30:
            quarter = "两刻"
elif random_minute < 45:
            quarter = "三刻"
else:
            quarter = "四刻"

print(f"这个时间是{quarter}吗?(是/否)")

# 随机决定是否正确
        is_correct = random.choice([TrueFalse])
ifnot is_correct:
# 生成错误的quarter
            all_quarters = ["一刻""两刻""三刻""四刻"]
            all_quarters.remove(quarter)
            quarter = random.choice(all_quarters)

print(f"问题:现在是{quarter}吗?")
        answer = input("你的回答(是/否):")

        correct_answer = "是"if is_correct else"否"
if answer == correct_answer:
print("✅ 正确!")
            score += 1
else:
            actual_quarter = ""
if random_minute < 15:
                actual_quarter = "一刻"
elif random_minute < 30:
                actual_quarter = "两刻"
elif random_minute < 45:
                actual_quarter = "三刻"
else:
                actual_quarter = "四刻"
print(f"❌ 错误!现在是{actual_quarter}")

elif question_type == "to_half":
# 差几分钟到整点/半点
if random_minute <= 30:
            target = 30
            target_name = "半点"
else:
            target = 60
            target_name = "整点"

        minutes_to = target - random_minute

print(f"差几分钟到{target_name}?")
try:
            answer = int(input("你的答案:"))
if answer == minutes_to:
print("✅ 正确!")
                score += 1
else:
print(f"❌ 错误!还差{minutes_to}分钟")
except:
print("❌ 请输入数字!")

else:  # angle
# 简化版时钟角度
        hour_angle = (random_hour % 12) * 30 + random_minute * 0.5
        minute_angle = random_minute * 6
        angle = abs(hour_angle - minute_angle)
        angle = min(angle, 360 - angle)

# 给出范围
if angle < 30:
            range_str = "小于30度"
elif angle < 60:
            range_str = "30-60度"
elif angle < 90:
            range_str = "60-90度"
else:
            range_str = "大于90度"

print(f"时针和分针的夹角大概是多少?")
print(f"1. 小于30度")
print(f"2. 30-60度")
print(f"3. 60-90度")
print(f"4. 大于90度")

        correct_choice = 1if angle < 30else2if angle < 60else3if angle < 90else4

try:
            answer = int(input("你的选择(1-4):"))
if answer == correct_choice:
print("✅ 正确!")
                score += 1
else:
print(f"❌ 错误!实际角度是{angle:.1f}度")
except:
print("❌ 请输入1-4的数字!")

# 显示成绩
print(f"\n{'='*30}")
print(f"📊 答题结果:{score}/{questions}")
percentage = (score / questions) * 100
print(f"正确率:{percentage:.1f}%")

if percentage == 100:
print("🎉 太棒了!你是时间大师!")
elif percentage >= 80:
print("👍 优秀!继续加油!")
elif percentage >= 60:
print("😊 不错!继续努力!")
else:
print("💪 加油!多练习会更好!")

🔧 常见问题解答

Q1:如何获取指定日期是星期几?

import datetime

# 创建指定日期
date = datetime.date(2023101)

# 方法1:使用weekday(),返回0-6,0是周一
weekday_num = date.weekday()  # 6表示周日
weekdays = ["星期一""星期二""星期三""星期四""星期五""星期六""星期日"]
print(f"方法1:{weekdays[weekday_num]}")

# 方法2:使用strftime
weekday_str = date.strftime("%A")  # 英文全称
print(f"方法2:{weekday_str}")

# 方法3:自定义格式
weekday_cn = date.strftime("%w")  # 0-6,0是周日
weekday_map = {"0""日""1""一""2""二""3""三""4""四""5""五""6""六"}
print(f"方法3:星期{weekday_map[weekday_cn]}")

Q2:如何计算两个日期间的天数?

import datetime

# 两个日期
date1 = datetime.date(202311)
date2 = datetime.date(20231231)

# 计算天数差
days_diff = (date2 - date1).days
print(f"从{date1}{date2}{days_diff}天")

# 包括今天
days_diff_inclusive = days_diff + 1
print(f"包括首尾共有{days_diff_inclusive}天")

Q3:如何在时间计算中处理闰年?

import datetime
import calendar

year = 2024

# 判断是否为闰年
is_leap = calendar.isleap(year)
print(f"{year}年是{'闰年'if is_leap else'平年'}")

# 获取一年的天数
days_in_year = 366if is_leap else365
print(f"{year}年有{days_in_year}天")

# 获取二月的天数
feb_days = calendar.monthrange(year, 2)[1]
print(f"{year}年2月有{feb_days}天")

📅 下节课预告

第10课:阶段项目-个性化名片生成器

下节课你将综合应用前9课所有知识:

  1. 制作个人信息系统
  2. 添加时间戳和随机ID
  3. 设计美观的输出格式
  4. 实现多种导出方式
  5. 添加个性化定制功能

准备任务

  1. 收集你的个人信息
  2. 想想你希望名片有什么特色
  3. 准备一些创意设计想法
  4. 复习前9课的知识点

💬 给家长的话

亲爱的家长

今天孩子学习了时间处理的相关知识,这是编程中非常实用和重要的部分。

孩子今天学会了

  1. ✅ 使用datetime模块处理时间
  2. ✅ 格式化显示各种时间格式
  3. ✅ 进行时间差计算
  4. ✅ 制作倒计时器和计时器
  5. ✅ 创建日程管理系统

时间管理的教育价值

技能
编程知识
实际应用
教育意义
时间获取
datetime模块
时钟、日历
时间观念
时间计算
时间差计算
倒计时、计时
规划能力
时间格式
字符串格式化
多格式显示
表达能力
日程管理
数据结构
课程表、提醒
自律能力

您可以这样做

实际应用

  1. 家庭日程
    :用孩子的程序管理家庭日程
  2. 学习计时
    :帮助孩子合理安排学习时间
  3. 纪念日
    :记录家庭重要纪念日
  4. 时间游戏
    :玩时间猜谜游戏

教育引导

  1. 培养孩子的时间管理意识
  2. 讨论时间的重要性
  3. 学习如何合理规划时间
  4. 理解计算机如何处理时间

温馨提示

  • 时间相关程序很实用,鼓励孩子实际使用
  • 帮助孩子将程序应用到学习中
  • 分享时间管理经验和技巧
  • 讨论不同文化对时间的理解

🏆 今日成就

完成了今天的学习,你:

⏰ 掌握了时间处理的核心技能 📅 创建了智能日程管理系统 ⏱️ 实现了倒计时和计时功能 🎮 开发了时间相关游戏 🔧 解决了时间计算的各种问题

挑战任务

  1. 为家人制作一个生日提醒程序
  2. 创建一个学习时间统计工具
  3. 设计一个世界时钟程序
  4. 实现一个番茄工作法计时器

🌟 编程心法

时间是程序的血脉
记录每一刻的变化
计算每一次的间隔
格式化每一次的展示
从获取到计算
从显示到应用
时间让程序有记忆
时间让功能有节奏
掌握时间
就掌握了程序的脉搏

记住:时间是编程中最重要的维度之一。今天你学到的不仅是技术,更是管理时间和生活的能力!


第9课结束。你现在已经能成为时间的主人了!

实践任务:1. 制作一个个人日程提醒程序2. 为学习创建番茄钟计时器3. 设计一个家庭纪念日历4. 实现一个精美数字时钟

下节课,我们将综合所有知识,制作完整的个人名片系统!

第10课见!🎉

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-06-04 13:47:08 HTTP/1.1 GET : https://www.yeyulingfeng.com/a/697910.html
  2. 运行时间 : 0.244471s [ 吞吐率:4.09req/s ] 内存消耗:4,850.50kb 文件加载:145
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=641cfd7dfa92e2b9d2ab3984f498a96e
  1. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_static.php ( 6.05 KB )
  7. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/ralouphie/getallheaders/src/getallheaders.php ( 1.60 KB )
  10. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  11. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  12. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  13. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  14. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  15. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  16. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  17. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  18. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  19. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions_include.php ( 0.16 KB )
  21. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions.php ( 5.54 KB )
  22. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  23. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  24. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  25. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/provider.php ( 0.19 KB )
  26. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  27. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  28. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  29. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/common.php ( 0.03 KB )
  30. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  32. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/alipay.php ( 3.59 KB )
  33. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  34. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/app.php ( 0.95 KB )
  35. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cache.php ( 0.78 KB )
  36. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/console.php ( 0.23 KB )
  37. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cookie.php ( 0.56 KB )
  38. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/database.php ( 2.48 KB )
  39. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/filesystem.php ( 0.61 KB )
  40. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/lang.php ( 0.91 KB )
  41. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/log.php ( 1.35 KB )
  42. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/middleware.php ( 0.19 KB )
  43. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/route.php ( 1.89 KB )
  44. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/session.php ( 0.57 KB )
  45. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/trace.php ( 0.34 KB )
  46. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/view.php ( 0.82 KB )
  47. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/event.php ( 0.25 KB )
  48. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  49. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/service.php ( 0.13 KB )
  50. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/AppService.php ( 0.26 KB )
  51. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  52. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  53. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  54. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  55. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  56. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/services.php ( 0.14 KB )
  57. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  58. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  59. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  60. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  61. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  62. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  63. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  64. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  65. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  66. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  67. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  68. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  69. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  70. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  71. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  72. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  73. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  74. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  75. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  76. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  77. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  78. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  79. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  80. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  81. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  82. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  83. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  84. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  85. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  86. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  87. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/Request.php ( 0.09 KB )
  88. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  89. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/middleware.php ( 0.25 KB )
  90. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  91. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  92. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  93. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  94. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  95. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  96. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  97. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  98. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  99. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  100. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  101. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  102. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  103. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/route/app.php ( 3.94 KB )
  104. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  105. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  106. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Index.php ( 9.87 KB )
  108. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/BaseController.php ( 2.05 KB )
  109. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  110. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  111. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  112. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  113. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  114. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  115. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  116. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  117. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  118. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  119. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  120. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  121. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  122. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  123. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  124. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  125. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  126. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  127. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  128. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  129. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  130. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  131. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  132. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  133. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  134. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  135. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Es.php ( 3.30 KB )
  136. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  137. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  138. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  139. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  140. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  141. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  142. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  143. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  144. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/runtime/temp/c935550e3e8a3a4c27dd94e439343fdf.php ( 31.50 KB )
  145. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000899s ] mysql:host=127.0.0.1;port=3306;dbname=wenku;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001530s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.002044s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000694s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001352s ]
  6. SELECT * FROM `set` [ RunTime:0.000607s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001558s ]
  8. SELECT * FROM `article` WHERE `id` = 697910 LIMIT 1 [ RunTime:0.015847s ]
  9. UPDATE `article` SET `lasttime` = 1780552028 WHERE `id` = 697910 [ RunTime:0.008418s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.000770s ]
  11. SELECT * FROM `article` WHERE `id` < 697910 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001240s ]
  12. SELECT * FROM `article` WHERE `id` > 697910 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001229s ]
  13. SELECT * FROM `article` WHERE `id` < 697910 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.006198s ]
  14. SELECT * FROM `article` WHERE `id` < 697910 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.024498s ]
  15. SELECT * FROM `article` WHERE `id` < 697910 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001726s ]
0.246303s