Reputation: 995
I have text which I want to show on newlines:
strname='A->1 B->2 C->1 Z->4'
Expected output:
A->1
B->2
C->1
Z->4
When I used end=
, it does not give any output:
strname='A->1 B->2 C->1 Z->4'
output= (strname, end='\n')
Upvotes: 1
Views: 42
Reputation: 521269
Use replace()
:
strname = 'A->1 B->2 C->1 Z->4'
output = strname.replace(' ', '\n')
print(output)
This prints:
A->1
B->2
C->1
Z->4
Upvotes: 1