1:sys模块
time.struct_time                实现时间转换
 >>> import sys
 >>> dir(sys)
  'getallocatedblocks', 'getdefaultencoding', 'getfilesystemencodeerrors', 'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval', 'gettrace', 'getunicodeinternedsize', 'getwindowsversion', 'hash_info', 'hexversion', 'implementation',  'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', 'stderr', 'stdin', 'stdlib_module_names', 'stdout', 'thread_info', 'unraisablehook', 'version', 'version_info', 'warnoptions', 'winver'
1.1获取递归的限制层数
 >>> sys.getrecursionlimit()
 1000
 >>> #getrecursionlimit  获取递归的限制层数
 >>> #setrecursionlimit  解除递归的限制层数

查找以.Java结尾的文件

2:time模块
 >>> import time
 >>> dir(time)
  'altzone', 'asctime', 'ctime', 'daylight', 'get_clock_info', 'gmtime', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'perf_counter', 'perf_counter_ns', 'process_time', 'process_time_ns', 'sleep', 'strftime', 'strptime', 'struct_time', 'thread_time', 'thread_time_ns', 'time', 'time_ns', 'timezone', 'tzname'
2.1asctime输出标准时间
 >>> #asctime输出标准时间
 >>> time.asctime()
 'Fri Mar 29 18:44:25 2024'
 >>> time.ctime()
 'Sat Mar 30 14:00:41 2024'
2.2 gmtime获取当前时间
 >>> time.gmtime()
 time.struct_time(tm_year=2024, tm_mon=3, tm_mday=30, tm_hour=6, tm_min=2, tm_sec=55, tm_wday=5, tm_yday=90, tm_isdst=0)
2.2.1time.gmtime().tm_year
 >>> time.gmtime().tm_year
 2024
2.2.2 time.gmtime().tm_mon
 >>> time.gmtime().tm_mon
 3
 >>> now = time.gmtime()
 >>> print(f"现在是北京时间{now.tm_year}-{now.tm_mday}{now.tm_hour}")
 现在是北京时间2024-306
 >>> now = time.localtime()
 >>> now
 time.struct_time(tm_year=2024, tm_mon=3, tm_mday=30, tm_hour=14, tm_min=10, tm_sec=8, tm_wday=5, tm_yday=90, tm_isdst=0)
2.3#休息时间,python中时间单位是秒,让程序休眠多少秒
 >>> time.sleep(4)
 >>>
 2.4 #time.time()时间戳
 
 >>> time.time()
 1711779345.2105186
 >>> time.time()
 1711779347.1384735
 >>> time.time()
 1711779348.2027082
2.4.1time.localtime(0)
 time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=8, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
2.4.2 time.gmtime(0)
 time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
 >>> a = time.gmtime(1711779348)
 >>> a
 time.struct_time(tm_year=2024, tm_mon=3, tm_mday=30, tm_hour=6, tm_min=15, tm_sec=48, tm_wday=5, tm_yday=90, tm_isdst=0)
2.4.3 #将1999年转化为时间戳
 >>> time.strptime("1999年3月4日 12:12:12", "%Y年%m月%d日 %H:%M:%S")
 time.struct_time(tm_year=1999, tm_mon=3, tm_mday=4, tm_hour=12, tm_min=12, tm_sec=12, tm_wday=3, tm_yday=63, tm_isdst=-1)
 >>> t = time.strptime("1999年3月4日 12:12:12", "%Y年%m月%d日 %H:%M:%S")
 >>> t
 time.struct_time(tm_year=1999, tm_mon=3, tm_mday=4, tm_hour=12, tm_min=12, tm_sec=12, tm_wday=3, tm_yday=63, tm_isdst=-1)
 >>> #将1999年转化为时间戳,构建时间戳
 >>> t = time.strptime("1999-3-4 12:12:12", "%Y-%m-%d %H:%M:%S")
 >>> t
 time.struct_time(tm_year=1999, tm_mon=3, tm_mday=4, tm_hour=12, tm_min=12, tm_sec=12, tm_wday=3, tm_yday=63, tm_isdst=-1)
 >>>
2.5time.strftime
 >>> help(time.strftime)
 Help on built-in function strftime in module time:
strftime(...)
     strftime(format[, tuple]) -> string
    %Y  Year with century as a decimal number.
     %m  Month as a decimal number [01,12].
     %d  Day of the month as a decimal number [01,31].
     %H  Hour (24-hour clock) as a decimal number [00,23].
     %M  Minute as a decimal number [00,59].
     %S  Second as a decimal number [00,61].
     %z  Time zone offset from UTC.
     %a  Locale's abbreviated weekday name.
     %A  Locale's full weekday name.
     %b  Locale's abbreviated month name.
     %B  Locale's full month name.
     %c  Locale's appropriate date and time representation.
     %I  Hour (12-hour clock) as a decimal number [01,12].
     %p  Locale's equivalent of either AM or PM.
 >>> time.strftime("%Y年%m月%d日")
 '2024年03月30日'
 2.6#datatime   
 
 >>> dir(datetime)
 ['MAXYEAR', 'MINYEAR', 'UTC', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'date', 'datetime', 'datetime_CAPI', 'time', 'timedelta', 'timezone', 'tzinfo']
2.6.1构建了一个2024.3.30的一个日期
 >>> datetime.date(2024,3,30)
 datetime.date(2024, 3, 30)
 >>> #构建了一个2024.3.30的一个日期
 >>>
 >>> datetime.time()
 datetime.time(0, 0)
 >>> datetime.time(12,12)
 datetime.time(12, 12)
 >>> datetime.time(12,12,12)
 datetime.time(12, 12, 12)
 >>> #12点12分121秒
 >>>
 >>> dir(datetime.date)
 'ctime', 'day', 'fromisocalendar', 'fromisoformat', 'fromordinal', 'fromtimestamp', 'isocalendar', 'isoformat', 'isoweekday', 'max', 'min', 'month', 'replace', 'resolution', 'strftime', 'timetuple', 'today', 'toordinal', 'weekday', 'year']
2.6.2  datetime中的datetime模块
 >>> from datetime import datetime
 >>> datetime
 <class 'datetime.datetime'>
 >>> dir(datetime)
 'astimezone', 'combine', 'ctime', 'date', 'day', 'dst', 'fold', 'fromisocalendar', 'fromisoformat', 'fromordinal', 'fromtimestamp', 'hour', 'isocalendar', 'isoformat', 'isoweekday', 'max', 'microsecond', 'min', 'minute', 'month', 'now', 'replace', 'resolution', 'second', 'strftime', 'strptime', 'time', 'timestamp', 'timetuple', 'timetz', 'today', 'toordinal', 'tzinfo', 'tzname', 'utcfromtimestamp', 'utcnow', 'utcoffset', 'utctimetuple', 'weekday', 'year']
 >>> datetime.now()
 datetime.datetime(2024, 3, 30, 14, 45, 37, 749918)
 >>> s = datetime.now()
 >>> s.time()
 datetime.time(14, 47, 8, 953058)
 >>> s.date()
 datetime.date(2024, 3, 30)
>>> s.year
 2024
>>> s.month
 3
 2.7calendar日历
 
 >>> import calendar
 >>> print(calendar.month(2024, 3))
      March 2024
 Mo Tu We Th Fr Sa Su
              1  2  3
  4  5  6  7  8  9 10
 11 12 13 14 15 16 17
 18 19 20 21 22 23 24
 25 26 27 28 29 30 31>>> # print(calendar.month(2024, 3))    打印月的日历
 >>>
 >>>