Many times I will use the Python interpreter to inspect variables and step through commands before I actually write to a file. However by the end I have around 30 commands in the interpreter, and have to copy/paste them into a file to run. Is there a way I can export/write the Python interpreter history into a file? For example >>> a = 5 >>> b = a + 6 >>> import sys >>> export('history', 'interact