1
我想爲單個值(行)做一個批量插入,我試圖使用executemany函數來這樣做,但它不會工作,它會返回TypeError: not all arguments converted during string formatting
。然而,當我添加一個額外的價值它的工作Python的MySQL數據庫executemany不工作在一個值
所以...... 它會在這裏返回一個錯誤:
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)