[Tutor] Which should it be, lists, tuples, dictionary or files?

Devin Jeanpierre jeanpierreda at gmail.com
Tue Jan 3 08:31:45 CET 2012


> Another option for you would be a shelve.(See the shelve module
> in the standard library) A file that acts like a dictionary.
> You can store a list of values against a single key.

It's probably worth mentioning that shelve is not secure; loading a
saved shelf can involve executing arbitrary python code embedded
inside it. This probably isn't important for this particular project,
but maybe in the future, if you consider using shelf for something
more security-conscious...

-- Devin

On Mon, Jan 2, 2012 at 8:24 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 03/01/12 00:31, Ken G. wrote:
>
>>> If you to store the data permanently, it has to go into a file. I
>>> suggest you learn about INI files to start with. Start by googling for
>>
>> Okay, thanks. I will look into it. Have not heard of INI file format.
>
>
> It's a Microsoft text file format invented for use on Windows but
> in fact is applicable to any kind of data stoorage with one or
> two levels of key.
>
> Another option for you would be a shelve.(See the shelve module
> in the standard library) A file that acts like a dictionary.
> You can store a list of values against a single key.
>
> Alternatively a simple SqlLite database would give you general searchability
> if that is important.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list