[Tutor] MySQLdb INSERT with while or for loop
Decibels
decibelshelp@charter.net
Wed Jun 11 13:42:02 2003
Ran into a slight sticking point with mysql. Created the tables fine, but inserting
information from a list is not sinking in.
Does anyone have an idea how to use a FOR or WHILE loop to INSERT data into a Table?
If it needs more explaination, then pointing me to a doc would be great. I am
checking the MySQL site docs and nothing so far.
The only examples I can find see to be explict inserts like below:
cursor.execute ("""
INSERT INTO animal (name, category)
VALUES
('snake', 'reptile'),
('frog', 'amphibian'),
('tuna', 'fish'),
('racoon', 'mammal')
""")
But I am wanting to do something similar to: I added the ...... instead of putting the whole table info
cursor.execute("""
INSERT INTO stockinfo (symbol,name,.......)
VALUES
( x=0
for x in results:
quotes9.cleanup(x)
)
""")