Python 代码:使用当前日期命名文件
import datetime
# 获取当前日期
now = datetime.datetime.now()
# 文件名
filename = 'xxx' + now.strftime('%Y-%m-%d') + '.txt'
# 创建文件
new_file = open(filename, 'w')
new_file.close()
原文地址: https://www.cveoy.top/t/topic/liEs 著作权归作者所有。请勿转载和采集!