From: Magnus L. H. <ml...@id...> - 2001-08-28 22:02:59
|
From: "Kevin Altis" <al...@se...> > > Is CSV import / export something that needs to be solved now? Is it > > required by something else? > > This issue came up because of the addresses and dbBrowser samples. A CSV > module would allow simple import/export for any PythonCard app. It isn't > critical right now, so anyone that wants to can pursue it and just add the > module to cvs when it is ready and notify the list. I'm not actively > pursuing it myself except via email. Why not use XML? It's much more powerful, and there's _lots_ of support for it in the standard libraries... You can even use the xmlrpclib for simple serialisation: >>> from xmlrpclib import dumps, loads >>> params = ['foo', 'bar', 1.0, 2, {'baz':42}], >>> string = dumps(params) >>> print string <params> <param> <value><array><data> <value><string>foo</string></value> <value><string>bar</string></value> <value><double>1.0</double></value> <value><int>2</int></value> <value><struct> <member> <name>baz</name> <value><int>42</int></value> </member> </struct></value> </data></array></value> </param> </params> >>> loads(string)[0][0] ['foo', 'bar', 1.0, 2, {'baz': 42}] As an added bonus, you can now easily transfer PythonCard stacks via xmlrpc -- even to apps written in other languages <wink>. And for a simpler grammar, the (X)HTML table is quite nice for this sort of thing. CVS is cute, but if you don't have to work with Excel etc. it may not be the best technology to use... (And you could always use tab-separated values, which is much simpler, and which is also supported by Excel etc.) > ka -- Magnus Lie Hetland http://www.hetland.org "Reality is that which, when you stop believing in it, doesn't go away." -- Philip K. Dick |