a = open("foo.txt","r")
print a.readlines()[0]
and
from linecache import *
print getline("foo.txt",1)
do the same thing, i.e print the first line of the given text file. So what is the necessity of the linecache module when the inbuilt file methods can do its task? Or is there some performance issues?
This post has been edited by cupidvogel: 20 January 2012 - 07:42 AM

New Topic/Question
Reply




MultiQuote





|