I'm using MySQLdb for inserting to a database, naturally my code looks similar to this:
db = MySQLdb.connect(host="111.111.111.111", port=3306,user="dba",passwd="somepass",db="somedb")
cursor = db.cursor()
cursor.execute("""
INSERT IGNORE INTO a (id,name) VALUES ('b', """+'diego' + """)""")
But it gets more and more cumbersome as more fields and values are added. I have to concatenate strings and sharp my eye to type in.
How can I print the execute string argument from two lists for fields and values, each?
For the example I would have:
fields = ['id','name']
values = ['b','diego']