How to save the output of a cell in iPython notebook

You have a typo, missing d in cap.stout. It should be cap.stdout
I tested the following and it worked fine. cap.show() also printed “stuff” and re-running the cell overwrote the file.

%%capture cap --no-stderr
print 'stuff'
with open('output.txt', 'w') as f:
    f.write(cap.stdout)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)