Re: Writing and reading variables to/from flat file

2006-12-15 Thread Caleb Hattingh
Hi Kevin The other posters helped you with configParser, which is what you wanted, i.e. text file access. However, you can also get persistance really cheaply with pickling, if you don't need the saved data to be text-editable: (from memory) verboseSettings = {} verboseSettings['Detailed'] =

Re: Writing and reading variables to/from flat file

2006-12-15 Thread bearophileHUGS
Geoffrey Clements: readfile = open('prefs').readlines() for line in readfile: print line eval(line) print Basic Instead of using eval, using a plain dict may be a better solution. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Writing and reading variables to/from flat file

2006-12-14 Thread Kevin Walzer
I want to write some variables (user preferences, specifically) to a text file and then read the values from that file. Here is my code to write the data: verbosemodes= Detailed = -vv Basic = -q file = open('prefs', 'w') file.writelines(verbosemodes) file.close() And here is my

Re: Writing and reading variables to/from flat file

2006-12-14 Thread Geoffrey Clements
Kevin Walzer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to write some variables (user preferences, specifically) to a text file and then read the values from that file. Here is my code to write the data: verbosemodes= Detailed = -vv Basic = -q file =

Re: Writing and reading variables to/from flat file

2006-12-14 Thread Bruno Desthuilliers
Kevin Walzer a écrit : I want to write some variables (user preferences, specifically) to a text file and then read the values from that file. http://docs.python.org/lib/module-ConfigParser.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing and reading variables to/from flat file

2006-12-14 Thread Jonathan Curran
On Thursday 14 December 2006 09:31, Kevin Walzer wrote: I want to write some variables (user preferences, specifically) to a text file and then read the values from that file. Here is my code to write the data: verbosemodes= Detailed = -vv Basic = -q file = open('prefs',