[Tutor] conventions for establishing and saving default values for variables

R. Alan Monroe amonroe at columbus.rr.com
Wed Jun 16 13:39:44 CEST 2010


> On Tue, Jun 15, 2010 at 2:27 PM, Pete O'Connell <pedrooconnell at gmail.com> wrote:
>> Hi I was wondering if anyone could give me some insight as to the best way
>> to get and save variables from a user the first time a script is opened. For
>> example if the script prompts something like "What is the path to the
>> folder?" and the result is held in a variable called thePath, what is the
>> best way to have that variable saved for all subsequent uses of the script
>> by the same user.
>> Pete

> In UNIX-likes, It would be a configuration file in their home
> directory, I suppose. Under windows, probably the registry. There's
> the _winreg and configparser modules.

Consider using the %USERPROFILE% environment variable rather than the
registry.

Alan



More information about the Tutor mailing list