[Tutor] Example for read and readlines()

Asad asad.hasan2004 at gmail.com
Sun Nov 11 01:49:36 EST 2018


Hi All ,

         If I am loading a logfile what should I use from the option 1,2,3

f3 = open ( r"/a/b/c/d/test/test_2814__2018_10_05_12_12_45/logA.log", 'r' )

1) should only iterate over f3

2) st = f3.read()
Should iterate over st


3) st1 = f3.readlines()

Should iterate over st1

How are the above options different it they are not can there be some
examples to describe in which situations should we each method .


Thanks,

-- 
Asad Hasan
+91 9582111698


More information about the Tutor mailing list