I can get rid of \ n
from a string, so I (" \ N "," ")
But when I do this," \ n "
is registered as a new line,
I'm sure That's a simple solution, but at the moment I'm stuck. Thank you for the future.
Side note: I can not use the strip ()
because it appears sometime in the middle. For example:
stringExample = ["a", "\ n", "b", "\ n", "g"] x = (str (StringExample) y = x.replace ("\ n", "") print (y)
- & gt; ["A", "\ n", "b", "\ n", "g"]
When you want to add a list to a string, you should not place it on the str
, as it essentially hides it in quotation marks. You need to connect with it together:
x = '' .join (string example)
example:
stringExample = ["a", "\ n", "b", "\ n", "g"] x = ''. Include (string example) y = x.replace ("\ n", "If you want it in a list as if it was in the beginning, then simply y
in a list < Enter
/ code>.
Comments
Post a Comment