any faster alternative??
Posted
by kaushik
on Stack Overflow
See other posts from Stack Overflow
or by kaushik
Published on 2010-06-10T04:44:03Z
Indexed on
2010/06/10
4:52 UTC
Read the original article
Hit count: 294
python
|Performance
I have to read a file from a particular line number and i know the line number say "n": i have been thinking of two choice:
1)for i in range(n) fname.readline() k=readline() print k
2)i=0 for line in fname: dictionary[i]=line i=i+1
but i want to know faster alternative as i might have to perform this on different files 20000 times. is there is any other better alternatives??
thanking u
© Stack Overflow or respective owner