I have a script that asks the user for the path to their desired directorydefault_path =  '/path/to/desired/directory/'user_path = raw_input(Enter new directory [{0}]: .format(default_path)) or default_pathprint user_pathThe script has a default directory if no input is given. I want the script to remember the directory entered by the user. That is, the next time the script is run I want the default path to be the path input by the last user. Is this possible?Maybe more generally, is there a good reference for writing command-line tools in python?
How can I get a python script to remember user input?
python
If you are maintaining the program, then make it store the history. In Python, use the readline library and make it store a history file.If you don't want to modify the program, you can use a wrapper such as rlwrap.rlwrap -H ~/.myprogram.history myprogram