Is there an easy way to print a string that contains a new line \n
, aligned to the left after a certain number of characters?
Basically, what I have is something like
A = '[A]: '
B = 'this is\na string\nwith a new line'
print('{:<10} {}'format(A, B))
The problem is that with the new line, the next lines do not start at the 10th column:
[A]: this is
a string
with a new line
I would like something like
[A]: this is
a string
with a new line
I could maybe split B
, but I was wondering if there was an optial way of doing this