User Tools

Site Tools


read_py_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
read_py_file [2018/05/02 20:47]
zeppo
read_py_file [2018/05/02 20:50] (current)
zeppo
Line 5: Line 5:
    f = open('​C:​\\temp\\one.txt',​ "​r"​)    f = open('​C:​\\temp\\one.txt',​ "​r"​)
    for line in f:    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())       print(line.strip())
    ​f.close()    ​f.close()
 +
  
read_py_file.1525312035.txt.gz ยท Last modified: 2018/05/02 20:47 by zeppo