write none to pipe python code example Example: python stop stdout f = open('/dev/null', 'w') sys.stdout = f