2024-04-25 16:37:32 发布
网友
我对python有点陌生,想做一个MySQL选择。你知道吗
我想从MySQL中进行选择,并向查询中添加一个变量,如下所示:
date = now.strftime("%Y-%m-%d) sql = "SELECT * FROM table WHERE date='%s'" % date
(这当然不行) 我已经习惯了Php,所以这对我来说有点陌生,你可以看到:)
谢谢!你知道吗
也许这就是你想要的。。。你知道吗
date = now.strftime("%Y-%m-%d) sql = "SELECT * FROM table WHERE date= '%s' " sql = sql % (date) cursor.execute(sql) results = cursor.fetchall()
import time now = time.localtime() date = time.strftime("%Y-%m-%d") sql = "SELECT * FROM table WHERE date='%s'" % date
我想这个碎片是你想要的吗?你知道吗
希望这有帮助
也许这就是你想要的。。。你知道吗
我想这个碎片是你想要的吗?你知道吗
希望这有帮助
相关问题 更多 >
编程相关推荐