How to save console output/view previous runs.
I'm new to Repl and to coding. I just created a MadLib program which I've had several friends run on my computer. Usually I clear the console before every run, but I just noticed upon sitting down again that the console contained the last four stories that had been created. Does that imply that it's already saved somewhere? Or how can I save it now and in the future so I can review and share the stories created?
Thanks for considering,
I think if you don't clear explicitly, the repl console doesn't clear the results of the last program, but simply moves the cursor down. If you want to save your own stories, write them to a text file or possibly store the variables in a json.
# madlibs.txt is text file # save madlib to variable madlib = "...." # appending to text file # writing erases previous contents so append to add without erasing with open("madlibs.txt",'a') as madlibs: madlibs.write(madlib) # read text file with open("madlibs.txt",'r') as madlibs: all_madlibs = madlibs.read() print(all_madlibs)