Useful snippets for Jupyter notebooks
✓ Published0🌍 Public
JJastor11
Last edited Nov 4, 2025
Created on Dec 10, 2025
This example shows how to manage notebook output and file operations using Jupyter's `%%capture` cell magic and IPython utilities. It captures noisy stdout and stderr streams, filters tagged error lines, and writes output to files using `%store` and Python's `print()` with a `file` argument. It also demonstrates file retrieval with `os.path.isfile` checks and curl, directory creation via `os.path.isdir`, and cleaning directories with shell commands. The code uses `IPython.utils.io.capture_output` and `shlex.quote` for safe command construction.
AI-generated description