I would like my script to act differently in an interactive shell session and when launched with a redirected stdout (for example, when it was passed to another command).
How to find out which of these two happens in a Python script?
An example of this behavior in an existing program: grep --color = auto highlights matches when launched in the interactive shell, but not when transferred to something else.
python shell
Paweł Hajdan May 13, '09 at 15:24 2009-05-13 15:24
source share