I answered a question.
Recently the answer has been deleted. Reason given is repost.
It claimed that my answer
The easiest solution I found so far is -
for stuff in largestring: if stuff.strip(): print(stuff)
was repost of gimel's answer.
Try list comprehension and string.strip():
>>> mystr = "L1\nL2\n\nL3\nL4\n \n\nL5" >>> mystr.split('\n') ['L1', 'L2', '', 'L3', 'L4', ' ', '', 'L5'] >>> [line for line in mystr.split('\n') if line.strip() != ''] ['L1', 'L2', 'L3', 'L4', 'L5']
What is the definition of repost?
I searched google, but could not get any answer.