Using Python and ystockquote - I import a dictionary of around 80+ values of financial data. I've setup a MySQL table with receiving columns with values like - previous_close, shares_owned, change_from_52_week_low. I'm getting stuck on sending the data from Python as a list to MySQL. I have broken the dictionary into just the values - so that the Python list would be all that is imported into the SQL table. What do I need to get the list of Python retus into the respective MySQL columns?
import MySQLdb
import ystockquote
mydb = MySQLdb.coect(host='localhost',
user= '****',
passwd='****',
db='****')
cur = mydb.cursor()
def store (values):
cur.execute('INSERT IGNORE INTO YAHOO (previous_close, shares_owned, change_from_52_week_low, revenue, Average_daily_volume, todays_range_realtime, today, etc....$
cur.coection.commit()
name = raw_input('please input a symbol_')
#str.split(str="", num=string.count(str)).
data = ystockquote.get_all(name)
list = data.values()
store(list)
print list
#data_keys = ('previous_close', 'shares_owned','change_from_52_week_low', 'revenue', 'Average_daily_volume', 'todays_range_realtime', 'today_open', 'Last_trade_re$
#print(ystockquote.get_all('name'))
#splits = str.split(str="", data)
#print (ystockquote.get_all(name)) # prints a dictionary of values - {key : value}
#print data.items() #this is prints a list tuples - key : value
#values = data.values
I know it's not the most efficient way to store values and looks forward to any assistance, thanks!
