【发布时间】:2014-08-11 15:05:06
【问题描述】:
我正在尝试对单个值(行)进行批量插入,我正在尝试使用 executemany 函数来执行此操作,但它不起作用,它返回 TypeError: not all arguments converted during string formatting。但是,当我添加一个额外的值时,它确实有效
所以... 这里会报错:
entries_list=[("/helloworld"),
("/dfadfadsfdas")]
cursor.executemany('''INSERT INTO fb_pages(fb_page)
VALUES (%s)''', entries_list)
但不是在这里:
entries_list=[("/helloworld", 'test'),
("/dfadfadsfdas", 'rers')]
cursor.executemany('''INSERT INTO fb_pages(fb_page, page_name)
VALUES (%s, %s)''', entries_list)
【问题讨论】:
标签: python mysql executemany