Answers for "python read file and remove newline"

3

python read file without newline

# converts read file into a list without newlines
temp = file.read().splitlines()
Posted by: Guest on April-15-2020
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

Code answers related to "python read file and remove newline"

Python Answers by Framework

Browse Popular Code Answers by Language