Answers for "how to remove empty lines from text python"

0

remove empty lines from file python

with open("new_file","r") as f:
 for i in f.readlines():
       if not i.strip():
           continue
       if i:
           print i,
Posted by: Guest on November-05-2020
0

how to remove blank lines from string in python

re.sub(r'^$n', '', s, flags=re.MULTILINE)
Posted by: Guest on June-15-2021

Code answers related to "how to remove empty lines from text python"

Python Answers by Framework

Browse Popular Code Answers by Language