Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Python: Insert records into MySQL database

Python: Insert records into MySQL database

import MySQLdb 
myBD = MySQLdb.connect(host="",
                       port=3306,user='myusernae',passwd='12345', db="Sales"))
bd_cursor = myBD.cursor()
customer=["Sako","Bill", "Adams"]
city=["Paris","New York","London"]
x = 0
for clt in customer:
    sqlCommand = "INSERT INTO Customers
    VALUES('%s', '%s')" %
    (customer, city[x])
    x += 1

Users who found this page were searching for:

  • how to create a button on python
  • get first point of a list java
  • javamail move message different folder
  • python open file
  • working directory python

No comments yet.

Leave a Comment