Created
December 9, 2012 03:30
-
-
Save cou929/4243210 to your computer and use it in GitHub Desktop.
sys.stdin.isatty() の確認
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python -c 'import sys; print dir(sys.stdin)' | |
['__class__', '__delattr__', '__doc__', '__enter__', '__exit__', '__format__', '__getattribute__', '__hash__', '__init__', '__iter__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'close', 'closed', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'mode', 'name', 'newlines', 'next', 'read', 'readinto', 'readline', 'readlines', 'seek', 'softspace', 'tell', 'truncate', 'write', 'writelines', 'xreadlines'] | |
$ python -c 'import sys; print sys.stdin.isatty()' | |
True | |
$ echo | python -c 'import sys; print sys.stdin.isatty()' | |
False | |
$ python -c 'import sys; print sys.stdin.isatty()' < ~/.bashrc | |
False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment