sql = "update table1 set ppid='{}', updatetime='{}' where name='{}'".format(ppid,NOW(),row[1]) 老是提示 NameError: name 'NOW' is not defined 啥情况啊 已经 import time 了啊 updatetime 字段设为 datetime类型了 大佬, 设为, 字段
import time current_time = time.strftime('%Y-%m-%d %H:%M:%S') # 格式化当前时间 sql = "update table1 set ppid='{}', updatetime='{}' where name='{}'".format(ppid, current_time, row[1]) [ol]import time current_time = time.strftime('%Y-%m-%d %H:%M:%S') # 格式化当前时间 sql = "update table1 set ppid='{}', updatetime='{}' where name='{}'".format(ppid, current_time, row[1])[/ol]复制代码
waiwaiwq 发表于 2023-11-26 07:37 import time current_time = time.strftime('%Y-%m-%d %H:%M:%S') # 格式化当前时间 兄弟是高手 感谢!