## data.csv ##
"name","symbol","value","change","mktcap","volume","open","high","low"
"Google Inc. ","GOOG ","512.19","-0.56 (-0.11%) ","159.87B ","3.08M ",
516.13,516.13,507
"Novell, Inc. ","NOVL ","6.84","-0.05 (-0.73%) ","2.39B ","4.49M ",
6.95,6.96,6.76
"Intl Business Machines Corp. ","IBM ","111.45","+1.45 (1.32%)
","151.62B ","8.27M ",110.4,111.68,110.01
"Microsoft Corporation ","MSFT ","28.30Â Â  ","+0.08 (0.28%)
","265.33B ","33.89M ",28.3,28.33,28.1
"Yahoo! Inc. ","YHOO ","23.13","-0.10 (-0.43%) ","30.98B ","15.59M ",
23.35,23.36,22.95
"Apple Inc. ","AAPL ","131.07","-1.44 (-1.09%) ","113.98B ","30.93M ",
133.26,133.34,129.76
"Red Hat, Inc. ","RHT ","19.24","-0.32 (-1.64%) ","3.72B ","2.30M ",
19.86,19.86,19.08
"Sun Microsystems, Inc. ","SUNW ","4.93","+0.07 (1.44%) ","17.60B
","92.71M ",4.87,4.93,4.8
"Adobe Systems Incorporated ","ADBE ","40.60","-0.17 (-0.42%)
","23.89B ","3.60M ",40.82,40.99,40.33

well now, we want to feed some database with this... have a look at
models + FinanceParser, a class which inherit from csv.DictReader
http://dpaste.com/17586/

how to use it ?

simple

f = open('data.csv')
parser = FinancerParser(f)
for row in parser:
    o = PortfolioEntry()
    data = parser.next()
    o.__dict__.update(data)
    o.save()

hope it helps.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to