Issue
I'm selecting text data from an SFrame and printing it. The text is really long, and the cell gets a horizontal scrollbar to view it. I would like to have it wrap to a newline and fit in my window, not to have a horizontal scrollbar.
I tried enabling/disabling the vscode command View: Toggle Word Wrap
, but that didn't change the output, even upon rerunning the script.
Solution
Unfortunately, VS Code doesn't currently support word wrap in the output or terminal windows.
You can try to use textwrap
package manually.
Add the following codes to your script:
import textwrap
wrapped_text = textwrap.fill(text, width=80) #text is the object which you want to print
print(wrapped_text)
Answered By - MingJie-MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.