Silly question re: 'for i in sys.stdin'?
Steven Bethard
steven.bethard at gmail.com
Mon Apr 4 11:23:29 EDT 2005
Jeff Epler wrote:
> On Sun, Apr 03, 2005 at 09:49:42PM -0600, Steven Bethard wrote:
>
>>Slick. Thanks!
>
> does isatty() actually work on windows? I'm a tiny bit surprised!
Hmm... I was just talking about using iter(f.readline, ''), but it does
appear that isatty returns True for sys.stdin in the interactive prompt:
ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on
Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
py> os.isatty(sys.stdin.fileno())
True
and at least some other things return False:
py> os.isatty(file('temp.txt').fileno())
False
STeVe
More information about the Python-list
mailing list