Re: [Tutor] Questions on file.read

2005-07-14 Thread Alan G
> Notice that when in non-blocking mode, less data than what was > requested > may be returned, even if no size parameter was given. > > What does "blocking-mode" mean, Its easier to answer by explaining blocking mode. In blocking mode the read will wait(block) until size bytes are available. Thi

Re: [Tutor] Questions on file.read

2005-07-14 Thread Kent Johnson
Max Noel wrote: > In any cas, you should try to avoid using file.read without a size > parameter. If you're processing text files, reading them one line at a > time would be a good start (for line in open ('filename.txt'): is an > instance of Best Thing Ever). Yes, this is good advice, if

Re: [Tutor] Questions on file.read

2005-07-14 Thread Max Noel
On Jul 14, 2005, at 12:26, Negroup - wrote: "To read a file's contents, call f.read(size), which reads some quantity of data and returns it as a string. size is an optional numeric argument. When size is omitted or negative, the entire contents of the file will be read and returned; it's your p

Re: [Tutor] Questions on file.read

2005-07-14 Thread Kent Johnson
Negroup - wrote: > read(...) > read([size]) -> read at most size bytes, returned as a string. > > If the size argument is negative or omitted, read until EOF is reached. > Notice that when in non-blocking mode, less data than what was requested > may be returned, even if no size pa

[Tutor] Questions on file.read

2005-07-14 Thread Negroup -
>>> help(f.read) Help on built-in function read: read(...) read([size]) -> read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be return