Displaying strings on IPython Notebook

When I execute the following code on IPython Notebook, the character string is displayed as it is and no line breaks occur.

msg = 'test\ntest\ntest\n'
msg
>>> 'test\ntest\ntest\n'

solution

If you print () as shown below, it will be displayed with a line break.

msg = 'test\ntest\ntest\n'
print(msg)
>>> test
>>> test
>>> test

By the way, when I'm trying to display the classification result using sklearn's classification_report () function, this problem? I fell into.

I didn't find such basic things in tutorials, and I didn't know what to look for, so I wasted about 15 minutes. .. ..

Recommended Posts

Displaying strings on IPython Notebook
Run IPython Notebook on Docker
IPython Notebook is now rendered on GitHub!
ipython notebook installation
IPython Notebook Recommendations
Launch and use IPython notebook on the network
Remotely connect IPython notebook
EC2 provisioning with Vagrant + Jupyter (IPython Notebook) on Docker
[Windows] [Python3] Install python3 and Jupyter Notebook (formerly ipython notebook) on Windows
Python environment construction on Mac (pyenv, virtualenv, anaconda, ipython notebook)
[IPython] How to Share IPython Notebook
Parallel computing with iPython notebook
High charts on Jupyter notebook
View PDF on Jupyter Notebook
How to use IPython Notebook
Play with Jupyter Notebook (IPython Notebook)
I want to announce my graduation thesis on IPython Notebook
Launch the IPython notebook server
Run Apache-Spark with IPython Notebook
Run Jupyter Notebook on windows
Graph drawing with IPython Notebook
Use Bokeh with IPython Notebook
Install Anaconda on Mac and upload Jupyter (IPython) notebook to Anaconda Cloud
R & D life with iPython notebook
Formatting with autopep8 on Jupyter notebook
Try using Pillow on iPython (Part 2)
Run azure ML on jupyter notebook
Install pip on CentOS7. Also iPython.
Try using Pillow on iPython (Part 3)
Build IPython Notebook environment with boot2docker
Batch processing notes in IPython Notebook
Try running Jupyter Notebook on Mac
Graph analysis and visualization on IPython Notebook using Cytoscape / cyREST and py2cytoscape Part 1