Yeah, sorry about that. The square brackets were supposed to indicate that filename is an optional argument. If not supplied, defaults to .history.
Dan Mahoney catd...@gmail.com Sent from my Android phone On Mar 25, 2011 6:57 PM, "Tim Chase" <python.l...@tim.thechases.com> wrote: On 03/25/2011 04:40 PM, Daniel Mahoney wrote: > On Fri, 25 Mar 2011 17:03:55 -0400, Ken D'Ambrosio wrote: > > Hey, all. A co-worker asked me a question, and I've got no idea how (or >> if) it can be done. Bottom line: he'd like to save off the text from an >> interpreter session, his thinking being that you've already tried to get >> what you want, and now you just need to gussy it up in an editor. >> > > import readline > readline.write_history_file([filename]) > Just to clarify (I thought Daniel's answer was so easy it must have misinterpreted the OP's request), that's a single string as a filename, not a list containing a filename. I tried filename = 'output.txt' import readline readline.write_history_file([filename]) and got a traceback about the expected parameter type. For clarity, it should have been readline.write_history_file(filename) or readline.write_history_file('output.txt') But otherwise, Daniel's given a dead-easy solution. -tkc
-- http://mail.python.org/mailman/listinfo/python-list