Task

Demonstrate how to check whether the output device is a terminal or not.



Related task

   Check input device is a terminal


import terminal
 
stderr.write if stdout.isatty: "stdout is a terminal\n" else: "stdout is not a terminal\n"