A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/078461.html below:

how to calculate the size of sys.stdin?

how to calculate the size of sys.stdin? 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4