python ValueError: Invalid format string-time.localtime())

File "D:/PycharmProjects/pythonProject_file_operation/main_file_op.py", line 14, in add_to_log
time2 = time.strftime('%Y-%m-%d %H:%M:%s', time.localtime())
ValueError: Invalid format string

 

%s,s小写,语法错误

改为大写:

time2 = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
posted @ 2023-12-29 14:52  txwtech  阅读(51)  评论(0编辑  收藏  举报