User Tools

Site Tools


read_py_file
 ########################################
 Save as readfile_1.py - works and removes blank lines
 ############################################
 import os
 f = open('C:\\temp\\one.txt', "r")
 for line in f:
    print(line.strip())
 f.close()
 
 #######################################
 the below is the same with explicit "readline"
 But does the same thing
 #######################################
 import os
 f = open('C:\\temp\\one.txt', "r")
 for line in f.readlines():
    print(line.strip())
 f.close()
read_py_file.txt · Last modified: 2018/05/02 20:50 by zeppo