Re: Loading a Python collection from an text-file

2006-01-28 Thread Ilias Lazaridis
Ken Starks wrote: Ilias Lazaridis wrote: within a python script, I like to create a collection which I fill with values from an external text-file (user editable). How is this accomplished the easiest way (if possible without the need of libraries which are not part of the standard

Re: Loading a Python collection from an text-file

2006-01-27 Thread Ido Yehieli
perhapse consider using the pickle module? http://docs.python.org/lib/module-pickle.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading a Python collection from an text-file

2006-01-27 Thread Bengt Richter
On Mon, 23 Jan 2006 21:00:55 +0200, Ilias Lazaridis [EMAIL PROTECTED] wrote: within a python script, I like to create a collection which I fill with values from an external text-file (user editable). How is this accomplished the easiest way (if possible without the need of libraries which are

Re: Loading a Python collection from an text-file

2006-01-27 Thread Fuzzyman
Seeing as we're suggesting alternatives, ConfigObj is great for hand readable/writable data persistence. You can use validate and ConfigPersist for automatic type conversion. You can persist (basically) all the standard datatypes using this. The syntax is usually more 'familiar' than Yaml, but

Re: Loading a Python collection from an text-file

2006-01-27 Thread Magnus Lycka
Ilias Lazaridis wrote: within a python script, I like to create a collection which I fill with values from an external text-file (user editable). If a spreadsheet like layout fits, use the csv module and a plain comma separated file. Then the end user can also use e.g. Excel to edit the data.

Re: Loading a Python collection from an text-file

2006-01-27 Thread Ido Yehieli
Sure, it's just a Python module with variables in it. I wouldn't try to teach my users Python syntax though. not to mention the security risks -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading a Python collection from an text-file

2006-01-27 Thread Fredrik Lundh
Ido Yehieli wrote: Sure, it's just a Python module with variables in it. I wouldn't try to teach my users Python syntax though. not to mention the security risks you mean all the things they can do from inside python that they cannot do from the command line ? /F --

Re: Loading a Python collection from an text-file

2006-01-26 Thread Ilias Lazaridis
[EMAIL PROTECTED] wrote: another approach (probably frowned upon, but it has worked for me) is to use python syntax (a dictionary, say, or a list) and just import (or reload) the file this sounds good. can I import a whole collection of instances this way? - (thanks for all the other

Re: Loading a Python collection from an text-file

2006-01-24 Thread jschull
another approach (probably frowned upon, but it has worked for me) is to use python syntax (a dictionary, say, or a list) and just import (or reload) the file -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading a Python collection from an text-file

2006-01-24 Thread Larry Bates
Take a look at ConfigParser module. The format of the file would be something like: [members] peter=16 anton=21 People are accustomed to this format file (windows .ini format). -Larry Ilias Lazaridis wrote: within a python script, I like to create a collection which I fill with values from

Re: Loading a Python collection from an text-file

2006-01-24 Thread [EMAIL PROTECTED]
Maybe YAML is what youre looking for... http://yaml.org -- http://mail.python.org/mailman/listinfo/python-list

Loading a Python collection from an text-file

2006-01-23 Thread Ilias Lazaridis
within a python script, I like to create a collection which I fill with values from an external text-file (user editable). How is this accomplished the easiest way (if possible without the need of libraries which are not part of the standard distribution)? something like: text-file: {peter,

Re: Loading a Python collection from an text-file

2006-01-23 Thread Ken Starks
Ilias Lazaridis wrote: within a python script, I like to create a collection which I fill with values from an external text-file (user editable). How is this accomplished the easiest way (if possible without the need of libraries which are not part of the standard distribution)?