'How to print following text on new line every pair?

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')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source