摘要: time.pref_counter()返回一个CPU级别的精确时间值,以秒为单位。 它通常用于测量某段程序的运行时间,因此取两次调用pref_counter()的差值才有意义。 import time time_start = time.perf_counter() for i in range(1 阅读全文
posted @ 2021-11-02 22:29 归去_来兮 阅读(1271) 评论(0) 推荐(0) 编辑
摘要: datetime是用于处理日期和时间的模块,一些常用的操作可通过提供的基本函数实现。引入模块——import datetime。 1.datetime转字符串——strftime()函数 有两种写法: datetime.datetime.strftime(datatime对象,格式化的字符串) 或 阅读全文
posted @ 2021-11-02 22:27 归去_来兮 阅读(1349) 评论(0) 推荐(0) 编辑