Task

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



Related task

   Check input device is a terminal


from sys import stdout
if stdout.isatty():
    print 'The output device is a teletype. Or something like a teletype.'
else:
    print 'The output device isn\'t like a teletype.'