Jump to content

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


Recommended Posts

Guest sayhello
Posted (edited)

i have a dictionary - THIS IS obviously a python dictionary

 

an this has approx 8 000 lines with records

 

$ 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...

Edited by AWS

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...