How to add linespace between outcomes from multiple print() commands in a single cell in Jupyter Notebook?

Viewed 134

Usually I put multiple print(***) in a single jupyter notebook cell. It's a bit hard to tell the results because there's no linespace between them. I could put print() between each print(***) to make a space but I was wondering if there is any better way.

2 Answers

You can insert the characters \n in the print function. Try the following:

for i in range(10):
    print("Number: " + str(i) + "\n")

This will create a line break between each print outputs.

If you would like to stress an end of line, you could use the end parameter of the print function:

endl = '\n' + 80*'*' + '\n'
print("Number:", number, end=endl)
Related