"Pete O'Connell" <pedrooconn...@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.
Others have mentioned ini files on Windows and resource files
in *nix as well as other options.
Another option depending on the purpose might be an
environment variable. But that would normally only be
used to, for example, set a path to where the ini file was
located - especially if it wasn't in the default location,
maybe being shared by a user group, say. So it
depends on the function of your variable too.
Personally I'd go with an ini/resource file in the users home
directory
as being the most consistent and simplest solution.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor