Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can save to file the on screen output of a Python IDE?

I use Spyder as my Python IDE. In most of what I do I use the editor to write code and execute portions of the program one at a time. I typically go back and forth, change things, add pieces, execute portions... you get it. Is there a way to save to file what Spyder shows in the console portion of the IDE after each portion of code is executed?

like image 905
ADJ Avatar asked Jan 30 '15 03:01

ADJ


People also ask

How do I save output as text in Python?

To write to a text file in Python, you follow these steps: First, open the text file for writing (or append) using the open() function. Second, write to the text file using the write() or writelines() method. Third, close the file using the close() method.

What is a Python IDE?

An IDE (or Integrated Development Environment) is a program dedicated to software development. As the name implies, IDEs integrate several tools specifically designed for software development. These tools usually include: An editor designed to handle code (with, for example, syntax highlighting and auto-completion)


1 Answers

(Spyder dev here) Well, there is a way to save the output shown in our consoles but not after each execution. You have to do it manually, like this:

  1. For our Python consoles, you need to do a right mouse click over any console and select the option Save history log.

  2. For our IPython consoles, you need to do a right mouse click over any console and select the option Save as HTML/XML

like image 176
Carlos Cordoba Avatar answered Sep 29 '22 08:09

Carlos Cordoba