Python Forum

Full Version: save a session in idle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi
suppose I am learning Python in idle. I want to save this session because I want to work on it for later(suppose I want to back to it tomorrow or some hours later).
is there any way to save this session in idle?
thanks
Have you looked at the menus?
What do you mean by "save this session"?

You can save a program/script file and use the file at a later time. You can save variable values to a file and restore them (json, pickle). I know of no way to save the current state of an interactive python interpreter.
(Nov-05-2023, 11:38 AM)Larz60+ Wrote: [ -> ]Have you looked at the menus?

hi and thanks
I looked and explored the menu bar at idle, but I did not find anything.
(Nov-05-2023, 03:24 PM)deanhystad Wrote: [ -> ]What do you mean by "save this session"?

You can save a program/script file and use the file at a later time. You can save variable values to a file and restore them (json, pickle). I know of no way to save the current state of an interactive python interpreter.

hi
you said:
Quote:save the current state of an interactive python interpreter.
I want this. suppose I am learning Python with idle. in idle I write some functions and variables and import commands and....
I want these for the next time that I continue to learn ( after lunch Smile ). With the turn of the computer, I will lose them. What can I do to have them for the next session of my learning? ( Note: I have turned off the computer)
thanks
ptpython and IPython save all history that typed in a interactive session.
IPython can just use arrow keys(up down) to get earlier code or print all with In [1]: %history -g.
ptpython is most advance Checking Code History and Reinserting Earlier Code.
[Image: UUn5AX.png]
[Image: IeHTrT.png]