Python
1date = 'Sun Jul 29 20:12:15 +0000 2018' 2cursor.execute("SELECT str_to_date(%s, '%a %b %d %T %f %Y')" % date) 3#cursor.execute("SELECT str_to_date('Sun Jul 29 20:12:15 +0000 2018', '%a %b %d %T %f %Y')") 4rows = cursor.fetchall() 5 6print(rows) 7 8db.commit()
MySQLの命令文に変数を置換しようとしたところ、
Traceback (most recent call last): File "show_test.py", line 13, in <module> cursor.execute("SELECT str_to_date(%s, '%a %b %d %T %f %Y')" % date) TypeError: not enough arguments for format string
以上のようなエラーが出ました。
どこが間違っているのでしょうか?
よろしくお願い致します。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。