Write a function named "csv_to_db" that takes a string as a parameter representing the name of a csv file and doesn't return a value. There is a database saved in a file named "port.db" containing a table named "introduce" with columns "luck", "reportedly", and "isolate". Read the csv file with the name equal to the input string and add each row of this file as a record in the table. Each row in the csv file will contain 3 strings as its values which should be used as the values for the three columns in the table.
import sqlite3
import csv
def csv_to_db(string):
conn = sqlite3.connect('port.db')
with open(string, 'r') as f:
reader = csv.reader(f)
for row in reader:
c = conn.cursor()
insert = c.executemany('INSERT INTO introduce VALUES (?, ?, ?)', row)
conn.commit()
Here is my attempt at the question; getting error: The current statement uses 3, and there are 10 supplied. How can I fix this?