+ 1
How do i remove an empty line from a string of lines
I have a string which was extracted from a json, the string has multiple lines with data ending with \n some of the lines have no data only the \n. I can't find a way to remove the lines that have only \n in them, please help.
3 Antworten
+ 3
if you have "\n\n" You know your are having an empty line
+ 3
This feels wasteful, but it works. This is not a best answer; maybe use it to compare examples:
print("\n".join(originalText.split("\n\n")))
0
I will test