There isn’t a true line break in the JupyterLab display. Zoom out in your browser and you should see the output of print(people)
on one line. In Chrome, Zoom out
is under View
.
The following in the notebook will get closer to listing each key per line but still fails with email
key in your provided example:
display(people)
But if you need to control display in Jupyter there may be other ways to accomplish what you seek? For example you can add in a little lightweight python code to do better handle things as you want. For example the following will place ’ keys list completely on each keys line’ as long as your JupyterLab window isn’t too narrow:
from IPython.display import Markdown, display
def printmd(string):
display(Markdown(string))
printmd(str(people).replace("],","], \n"))
With that code in Jupyter, you’ll see as output:
{'first': ['Corey', 'Jane', 'John'],
'last': ['Shafer', 'Doe', 'Millard'],
'email': ['CoreyMSchafer@gmail.com', 'JaneDoe@email.com', 'JohnM81@hotmail.com']}
(I employ that printmd()
function in other answers here and here. Relying on the output now being markdown, I added in some markdown syntax to the string representation of the dictionary to control displaying parts more.)