I have text which I want to show it on newline
strname='A->1 B->2 C->1 Z->4'
Expected output:
A->1
B->2
C->1
Z->4
When I used end does not give any output
strname='A->1 B->2 C->1 Z->4'
output= (strname,end='\n')
>Solution :
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