separate print( ) results in Python

Jeremy :

I use Python in Jupyternotebook. I mainly work with hdf5 or netcdf4 data, so there are always descriptions along with the data. When I want to read and view multiple data at the same time, I would use

print(A)
print(B)
print(C) 
...

Then the problem is that when the descriptions are really long, it is hard to distinguish which paragraphs are for which data. I tried this to help me separate them.

print(A)
print('-------------------------------')
print(B)

But this may introduce too many additional lines. Is there any smarter way to solve this? Thanks.

DuDoff :

What about using f-strings like:

>>> A = "My A"
>>> print(f'This is A: \n{A}')
This is A: 
My A

OR

>>> print(f'### A ###\n{A}')
### A ###
My A

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=194319&siteId=1