On Feb 19, 6:58 pm, GiBo [EMAIL PROTECTED] wrote:
Hi!
Classic situation - I have to process an input stream of unknown length
until a I reach its end (EOF, End Of File). How do I check for EOF? The
input stream can be anything from opened file through sys.stdin to a
network socket. And it's
On 2/20/07, Nathan [EMAIL PROTECTED] wrote:
On 2/19/07, Gabriel Genellina [EMAIL PROTECTED] wrote:
En Mon, 19 Feb 2007 21:50:11 -0300, GiBo [EMAIL PROTECTED] escribió:
Grant Edwards wrote:
On 2007-02-19, GiBo [EMAIL PROTECTED] wrote:
Classic situation - I have to process an input
On 2/19/07, Gabriel Genellina [EMAIL PROTECTED] wrote:
En Mon, 19 Feb 2007 21:50:11 -0300, GiBo [EMAIL PROTECTED] escribió:
Grant Edwards wrote:
On 2007-02-19, GiBo [EMAIL PROTECTED] wrote:
Classic situation - I have to process an input stream of unknown length
until a I reach its end
Hi!
Classic situation - I have to process an input stream of unknown length
until a I reach its end (EOF, End Of File). How do I check for EOF? The
input stream can be anything from opened file through sys.stdin to a
network socket. And it's binary and potentially huge (gigabytes), thus
for line
On 2007-02-19, GiBo [EMAIL PROTECTED] wrote:
Hi!
Classic situation - I have to process an input stream of unknown length
until a I reach its end (EOF, End Of File). How do I check for EOF? The
input stream can be anything from opened file through sys.stdin to a
network socket. And it's
GiBo wrote:
Hi!
Classic situation - I have to process an input stream of unknown length
until a I reach its end (EOF, End Of File). How do I check for EOF?
[...]
I'd better like something like:
while not stream.eof():
...
Is there a reason why some classes distributed with
Grant Edwards wrote:
On 2007-02-19, GiBo [EMAIL PROTECTED] wrote:
Hi!
Classic situation - I have to process an input stream of unknown length
until a I reach its end (EOF, End Of File). How do I check for EOF? The
input stream can be anything from opened file through sys.stdin to a
network
En Mon, 19 Feb 2007 22:30:59 -0300, GiBo [EMAIL PROTECTED] escribió:
Is there a reason why some classes distributed with Python 2.5 are not
new-style classes? For instance StringIO is apparently old-style class
i.e. not inherited from object. Can I somehow turn an existing
old-style class to
Gabriel Genellina wrote:
En Mon, 19 Feb 2007 22:30:59 -0300, GiBo [EMAIL PROTECTED] escribió:
Is there a reason why some classes distributed with Python 2.5 are not
new-style classes? For instance StringIO is apparently old-style class
i.e. not inherited from object. Can I somehow turn an
GiBo wrote:
One more question - is it likely that StringIO will be turned into
new-style class in the future? The reason I ask is whether I should try
to deal with detection of new-/old-style classes or take the
old-styleness for granted and set in stone instead.
In Python 3.0, everything
On 2007-02-20, GiBo [EMAIL PROTECTED] wrote:
stream = sys.stdin
while True:
data = stream.read(1024)
if len(data) == 0:
break #EOF
process_data(data)
Right, not a big difference though. Isn't there a cleaner /
more intuitive way?
A file is at EOF when read()
In article [EMAIL PROTECTED], Gabriel Genellina wrote:
So this is the way to check for EOF. If you don't like how it was spelled,
try this:
if data==: break
How about:
if not data: break
? ;-)
--
http://mail.python.org/mailman/listinfo/python-list
12 matches
Mail list logo