文件名加时间

#encoding:utf-8

import os,sys

import csv

import time

now = time.strftime("%Y-%m-%d-%H_%M_%S",time.localtime(time.time()))

fname="D:/logs/"+now+r"report.csv"

csvFile = open(fname,'wb')

fileHeader = ["x", "y","z"]

writer = csv.writer(csvFile)

writer.writerow(fileHeader)

csvFile.close()

你可能感兴趣的:(文件名加时间)