Answers for "python3 remove empty lines windows"

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 delete blank rows from text file in spyder

with open(fname, 'r+') as fd:
    lines = fd.readlines()
    fd.seek(0)
    fd.writelines(line for line in lines if line.strip())
    fd.truncate()
Posted by: Guest on November-24-2020

Code answers related to "python3 remove empty lines windows"

Python Answers by Framework

Browse Popular Code Answers by Language