How to save print output as well as plots in python to a single file in whichever output file format, be it .txt, .html, .pdf, etc. in an automated fashion? Since I will be doing this for thousands of outputs and plots, is there a python command I can use.
I know we can save them separately using python commands, but is there a python command to save them together in the same order that they are outputted, for example how they appear in a Jupyter notebook together as shown below. The format of the file in which they are saved does not matter as long as there is a way to save both together (ideally file format should not be very memory intensive, but that is secondary).
This is so that I can open the file later in a folder and the output is saved for me to always access later. If there is a lot of output Jupyter notebook unfortunately crashes, corrupting the file and making the code irrecoverable.