【python】时间处理函数以及文件操作_file = open('log/log-{timestamp}.txt', 'a')-CSDN博客

网站介绍:文章浏览阅读182次。1. 时间函数模块(库)-使用流程:先导入,再引用1:导入 方式一:import 模块名 引用:模块名.函数名() 方式二:from 模块名 import 函数名/变量/类 函数名后面不需要括号 引用:函数名()time模块 时间戳(秒数的总和) 1970年1月1日之后的秒,即:time.time() 格式化的字符串 2019-11-11 11:11, 即:time.strftime('%Y-%m-%d') 结构化时间 元.._file = open('log/log-{timestamp}.txt', 'a')