NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS" I want to print a like "> NKMFFALGLLGDGVIGALDTVVSSMGAVGA...">

Replace with newline python

I have a line

a=">NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS" 

I want to print a like

 "> NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS" 

I did a=a.replace(">","> \n") but this will not work. Where am I mistaken?

+6
source share
1 answer

One thing is the internal representation of the string:

 >>> a=">NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS" >>> a.replace(">","> \n") '> \nNKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS' 

the other is how it will be displayed on the screen:

 >>> print(a.replace(">","> \n")) > NKMFFALGLLGDGVIGALDTVVSSMGAVGASGLS 
+8
source

Source: https://habr.com/ru/post/892001/


All Articles