시간 표현
일반적인 시간 표현은 다음과 같습니다.
타임 스탬프#🎜🎜 #
형식화된 시간 문자열
사례 연습:
#endcoding: utf-8 # 获取文件的时间属性 # 用到的知识 # os.getcwd() 方法用于返回当前工作目录 # os.path.getatime(file) 输出文件访问时间 # os.path.getctime(file) 输出文件的创建时间 # os.path.getmtime(file) 输出文件最近修改时间 import time import os def fileTime(file): return [ time.ctime(os.path.getatime(file)), time.ctime(os.path.getmtime(file)), time.ctime(os.path.getctime(file)) ] times = fileTime(os.getcwd()) print(times) print(type(times))
위 내용은 파일 생성 및 수정 시간을 얻는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!