Search code examples
pythonpython-3.x

How to remove Empty Rows from a list in Python 3.5


apple
mango
banana

tea

coffee

Can someone please suggest a python code to remove the empty rows in this case after banana/tea/coffee so the actual result should be as below without any empty rows in between and after the end of lists

apple
mango
banana
tea
coffee

Solution

  • i have forgot to check the spaces after last string in the file. After i remove the spaces and bringing the curser just in parallel to the last string, this solves the problem. thanks all.