import time nowStr = time.strftime("%Y-%m-%d_%H-%M-%S.csv", time.localtime(time.time())) print(nowStr)