Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20709
| References | <CAJ1erZ1qT1ObRWCmJ0bZez++c8EXn772JQgfr4oO3CGRFnwMoA@mail.gmail.com> |
|---|---|
| Date | 2012-02-23 17:31 +1100 |
| Subject | Re: storing in list and retrieving. |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.62.1329978688.3037.python-list@python.org> (permalink) |
On Thu, Feb 23, 2012 at 5:24 PM, Smiley 4321 <ssmile03@gmail.com> wrote: > I need to write two file using python script as below - > > 1. Store.py: Write a script to store a list say "store_list = ["Apple", > "Orange", "PineApple". “and so on” ]" to disk. > > 2. Retrieve.py: Read the object stored in the ‘Store.py’ file and print the > contents of this list. > > I have to run on Linux with python-2.6.5. This looks like homework, so I'm just going to give a broad hint. Figure out a file format (one per line, or pickled, or whatever), then write one program that writes that format and another that reads it. The open() built-in function will open files for reading or writing, so that's a good place to start. Get as far as you can on your own, and if you get stuck, ask the list for more specific help. Good luck! Chris Angelico
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: storing in list and retrieving. Chris Angelico <rosuav@gmail.com> - 2012-02-23 17:31 +1100
csiph-web