The sys module

Functions and variables used by the interpreter

     sys.argv              # Command line arguments
     sys.path              # Module search path
     sys.maxint            # Maximum integer value
     sys.stdin             # Standard input
     sys.stdout            # Standard output
     sys.stderr            # Standard error
     sys.ps1               # Interactive interpreter prompt (>>>)
     sys.ps2               # Interactive interpreter prompt (...)
     sys.exc_info()        # Information about last raised exception
     sys.exit(n)           # Exit from the interpreter 
  • In addition, the module provides version and installation information
     sys.version           # Version string
     sys.prefix            # Installation prefix
     sys.copyright         # Copyright message
     sys.executable        # Name of executable
<<< O'Reilly OSCON 2000, Introduction to Python, Slide 121
July 17, 2000, beazley@cs.uchicago.edu
>>>