How to Wrap Long Text Output in Jupyter Notebook for Cleaner Print Display?

20 Replies, 1514 Views

Oh, the Jupyter notebook wrap long text print struggle is real!

I’ve been using `textwrap` for ages, but recently I discovered `pandas` has this cool `style` module. You can do stuff like `df.style.set_table_styles([{'selector': 'td', 'props': [('white-space', 'pre-wrap')]}])`.

Also, if you’re into markdown, you can use `<pre>` tags to preserve formatting.

Messages In This Thread



Users browsing this thread: 1 Guest(s)