开发者

Replace with newline python

开发者 https://www.devze.com 2023-03-17 02:38 出处:网络
I have a string a=\">NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS\" I want print a as \"> NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS\"

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
0

精彩评论

暂无评论...
验证码 换一张
取 消