how to calculate the size of sys.stdin?
Chris Gonnerman
chris.gonnerman at usa.net
Wed Apr 11 19:14:25 EDT 2001
----- Original Message -----
From: "Kalle Svensson" <kalle at gnupung.net>
Subject: Re: how to calculate the size of sys.stdin?
> Sez Graham Guttocks:
> > Is there a way to calculate the size (in bytes) of sys.stdin?
>
> No, sys.stdin has no size. What you can do is read from sys.stdin and
check
> how much you got:
sys.stdin has size if it is connected to a normal file, or
to some device nodes (in unixoid OS environments). Size is
not available for terminals, pipes, etc.
I just tested with Python 1.5.2 under Linux 2.2 and got 0
for size of a terminal, but correct figures for file sizes
using redirection:
$ python sizer.py
0
$ python sizer.py <sizer.py
95
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sizer.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20010411/e28b1ad4/attachment.ksh>
More information about the Python-list
mailing list