reading from sys.stdin
7stud
bbxx789_05ss at yahoo.com
Fri Apr 13 05:47:04 EDT 2007
On Apr 13, 3:36 am, "7stud" <bbxx789_0... at yahoo.com> wrote:
>
> > It is if the file is smaller than the buffer size.
>
> How is that relevant?
>
If I put 100 lines of text in a file with each line having 50
characters, and I run this code:
import sys
lst = []
for line in open("aaa.txt"):
print "an iteration"
lst.append(line)
break
print lst
The output is:
$ python test1.py
an iteration
['helleo haljdfladj ahdflasdjf ds hdljfalsdjfdsljfds \n']
It seems clear to me that the whole file wasn't first read into a
buffer before the code started processing the data.
More information about the Python-list
mailing list