The following is how I usually add in params in MySQLdb:
cursor.execute('INSERT INTO main_territory (code, name) VALUES (%s, %s)', (item[0], item[1]))
Is there a way to make the string formatting more intuitive? For example, if I have 50 args in the INSERT. Something like:
cursor.execute('''INSET INTO main_territory (code, name) VALUES ({code}, {name})''',
{code=item[0], name=item[1}
)