惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Y
Y Combinator Blog
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
S
SegmentFault 最新的问题
J
Java Code Geeks
V
Visual Studio Blog
H
Help Net Security
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
B
Blog RSS Feed
The Cloudflare Blog
MyScale Blog
MyScale Blog
月光博客
月光博客
Microsoft Security Blog
Microsoft Security Blog
美团技术团队

博客园 - 狗狗听话

SpringBoot学习之缓存@Caching, @Cacheable,@CacheEvict Java学习之 EasyExcel Java学习之LocalDateTime, LocalDate, LocalTime python在某个目录下的查找指定文件夹 SpringBoot学习之JPA设置多个主键的方法 Python使用psycopg2的copy_from方法高效的大量数据批量导入 SpringBoot学习之文件上传(利用postman测试) SpringBoot学习之文件上传,下载 Python常用的语法糖 Java学习之 stream 常用方法 SpringBoot学习之使用idea打包jar文件 React学习之数组 Java学习之日期时间转换 Java读取execl 利用JDBC插入Postgresql简单示例 Springboot中项目启动加载的几种方式 Java selenium实现浏览器ctrl + s功能 Macbook pro 安装Redis Macbook pro 打开pgAmin报错 SpringBoot学习之任务定时器 关于git rebase中的一些问题:Git报错“no branch, rebasing master”
Python学习之datetime
狗狗听话 · 2025-12-29 · via 博客园 - 狗狗听话

image

import os, datetime

from datetime import date
from pathlib import Path

file_path = "C:\\Users\\mengchen.shao\\Desktop\\BET"

path = Path(file_path)

for file in path.iterdir():
creation_time = os.path.getctime(file)
update_time = os.path.getmtime(file)
cre_date = datetime.datetime.fromtimestamp(creation_time).date()
upd_date = datetime.datetime.fromtimestamp(update_time).date()
today = date.today()
print(f"{file}文件的创建时间:{(today - cre_date).days}")
print(f"{file}文件的更新时间:{(today - upd_date).days}")

posted @ 2025-12-29 15:03  狗狗听话  阅读(9)  评论()    收藏  举报