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

Python: Insert records into MySQL database

Python: Insert records into MySQL database
{filelink=16371}

import MySQLdb 
myBD = MySQLdb.connect(host="127.0.0.1",
                       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])
    bd_cursor.execute(sqlCommand)
    x += 1

Users who found this page were searching for:

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

No comments yet.

Leave a Comment