I have a Python script that I want to run in IPython. I want to redirect (write) the output to a file, similar to:
python my_script.py > my_output.txt
Writing a script seemed overkill for me, as I just wanted something simple to look at a lot of text contained in a variable while working in IPython. This is what worked for me:
%store VARIABLE >> file.txt (appends) %store VARIABLE > file.txt (overwrites)
%store VARIABLE >> file.txt
%store VARIABLE > file.txt