parameters: (filename)
docstring: Open the specified file for writing, or returns sys.stdout if filename is "-".
docstring_summary: Open the specified file for writing, or returns sys.stdout if filename is "-".
docstring_tokens: Open the specified file for writing or returns sys . stdout if filename is - .
function: def open_or_use_stdout(filename):
      """Open the specified file for writing, or returns sys.stdout if filename is "-"."""
  
      if filename == "-":
          yield sys.stdout
          return
  
      line_buffered = 1
      try:
          fp = open(filename, "w", line_buffered)
      except IOError:
          print("Could not open file {}".format(filename), file=sys.stderr)
          sys.exit(1)
  
      try:
          yield fp
      finally:
          fp.close()
function_tokens: def open_or_use_stdout ( filename ) : if filename == "-" : yield sys . stdout return line_buffered = 1 try : fp = open ( filename , "w" , line_buffered ) except IOError : print ( "Could not open file {}" . format ( filename ) , file = sys . stderr ) sys . exit ( 1 ) try : yield fp finally : fp . close ( )