[Tutor] Working with files, Truckers log
Kirby Urner
urnerk@qwest.net
Thu, 04 Apr 2002 21:47:24 -0800
At 05:58 PM 4/4/2002 +0000, glidedon wrote:
>I think I know how to read and write to a file ,but how do I
>insert this data into the list in my program ?
Note that one solution to saving data is to write out
text which also happens to be executable Python code.
Save the file as a .py, and when you want your data
back, just import it.
For example, if my saved data file looks like this:
a = [1,2,3]
b = {'a':10,'b':30}
then in another program I can go:
from mydata import a,b
and I'll have those values available to me.
Just a thought.
Kirby