how to store a python-dictionary into a mysql-database

  • Thread starter Thread starter sayhello
  • Start date Start date
S

sayhello

i have a dictionary - THIS IS obviously a python dictionary

an this has approx 8 000 lines with records

Code:
$ python printer.py
{'url': 'http://www.site1_com', 'cname': 'butcher', 'name': 'cheng', 'email': 'mail1@hotmail.com'}
{'url': 'http://www.site2_com', 'cname': 'dilbert', 'name': 'James', 'email': 'mail2@hotmail.com'}

i have a mysql-db up and runing in my opensuse

there i have created a db with the fields

url
cname
name
email

i use the

import MySQLdb

i studied this documentation here: http://stackoverflow.com/questions/3...base-in-python

but i think this goes a bit over my head.


- well how can i get the data ( in other words the dictionary) into the database?

love to hear from you

greetings

Continue reading...
 
Last edited by a moderator:
Back
Top