python 2.4.3 sqlite执行语法

python 2.4.3 sqlite执行语法,python,sqlite,executemany,Python,Sqlite,Executemany,我一直在使用Python2.4.3和该发行版附带的sqlite模块 如何在此环境中运行executemany命令?更现代的语法似乎有一个问题 import sqlite as sql conn = sql.connect('test.db') c = conn.cursor() c.execute('''create table test(item text)''') list = ['apple', 'orange', 'banana'] c.executemany('''insert in

我一直在使用Python2.4.3和该发行版附带的sqlite模块

如何在此环境中运行executemany命令?更现代的语法似乎有一个问题

import sqlite as sql
conn = sql.connect('test.db')
c = conn.cursor()
c.execute('''create table test(item text)''')
list = ['apple', 'orange', 'banana']

c.executemany('''insert into test values(?)''', list)
我想Python2.4.3已经很旧了,我找不到任何文档,而且我没有与executemany函数关联的关联doc字符串


我感谢你的帮助

您应该使用
%s
而不是

import sqlite as sql
conn = sql.connect('test.db')
c = conn.cursor()
c.execute('''create table test(item text)''')
list = ['apple', 'orange', 'banana']
c.executemany('''insert into test values(%s)''', list)

具体的错误信息是什么?谢谢,但还是不太清楚。我得到TypeError:在字符串格式化过程中并非所有参数都被转换。我运行的代码和上面一样,明白了。在此旧版本中,其内容为:。executemany(“”“插入测试值(%s)”,列表)