Movatterモバイル変換
[0]ホーム
how to calculate the size of sys.stdin?
Donn Cavedonn at u.washington.edu
Wed Apr 11 19:37:50 EDT 2001
Quoth Graham Guttocks <graham_guttocks at yahoo.co.nz>:| Is there a way to calculate the size (in bytes) of sys.stdin? I tried| to use the "stat" module to accomplish this, but os.stat() seems to| only accept the name of a file. (i.e, the following doesn't work):|| import os,stat| size = os.stat(sys.stdin.read())[stat.ST_SIZE]os.fstat(sys.stdin.fileno())This makes sense only when stdin happens to be a disk file, of course.I don't understand why you would try sys.stdin.read() in the aboveexample, so I don't know if this helps or not, but you'll know ifyou try it.Donn Cave,donn at u.washington.edu
More information about the Python-listmailing list
[8]ページ先頭