In article <[email protected]>,
 Paul Rubin <[email protected]> wrote:

> Lou Pecora <[email protected]> writes:
> > after much noodling around and reading it hit me that I could just put
> > all that output of different types of variables into a list, hit it
> > with a repr() function to get a string version, and write the string
> > to a file -- no formatting necessary-- three lines of code. Later
> > reading in the string version (no formatting necessary), and hitting
> > it with an eval() function returned all the values I originally had in
> > those variables.  How simple, but beautiful.
> 
> FYI: I do that too sometimes, but in general using repr/eval that way
> is poor style and not very reliable.  It's better to use the pickle
> module, which is intended for that sort of thing, or the json module
> if your datatypes are suitable and you want to follow a semi-standard.

Yeah, I should look into pickle.  Haven't messed with that.  Most of 
what I do is numerical calculations for my consumption/research so quick 
and easy comes first.  Thanks for the hint.

-- 
-- Lou Pecora
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to