[Tutor] Re: Saving Files for Spreadsheet Exporting

Derrick 'dman' Hudson dman@dman.ddts.net
Fri, 16 Aug 2002 00:11:15 -0400


--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 14, 2002 at 05:30:23PM -0700, Alan Colburn wrote:
| Two quick questions today:
|=20
| 1) I'd like to save a file, with a list of lists, in a format that could =
be
| read directly into a spreadsheet. Each list would represent a different r=
ow,
| and each list element a different column. How would I go about doing this?
| (List elements are strings.)

Look into using either the CSV (Comma-Separated Values) or
Tab-Separated Values formats.

| 2) In the interest of "teaching a man to fish" (rather than "giving him a
| fish"), how would you go about searching the Python documentation to find=
 an
| answer to this question? ... That's where I started, but I wasn't success=
ful
| :-)

The trick is to know what you have and know where you are going.  You
have the first part down, but not the second.  After reading this
message you know the second (CSV), so you can search the Vaults of
Parnassus for some existing code.  I happen to know that (at least a
year ago) there were some CSV modules available there.  If you can't
find one, then you need to write one.  I see that some other posters
have given the simplistic (but incomplete) method for doing that.
(they are incomplete because they don't handle data with embedded
commas or quotes, but CSV has rules for encoding that stuff)

HTH,
-D

--=20
[Perl] combines all the worst aspects of C and Lisp: a billion different
    sublanguages in one monolithic executable.
It combines the power of C with the readability of PostScript.
        -- Jamie Zawinski
=20
http://dman.ddts.net/~dman/

--sdtB3X0nJg68CQEu
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj1ce2MACgkQO8l8XBKTpRRF2QCcCXpbYN633nmAzGL8fRUy8mOL
BwgAoJEch4qvu4yY4BhDV4g2sTVzK8Iv
=XsIb
-----END PGP SIGNATURE-----

--sdtB3X0nJg68CQEu--