Replace with newline python
I have a string
a=">NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS"
I want print a as
">
NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS"
I did a=a.replace(">","> \n")
but it doesn开发者_高级运维't work. Where am I going wrong?
One thing is the internal representation of the string:
>>> a=">NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS"
>>> a.replace(">","> \n")
'> \nNKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS'
another one is how it will be shown on screen:
>>> print(a.replace(">","> \n"))
>
NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS
精彩评论