Environment Variables

Reading Environment Variables

  • Use the os module
     import os
     path = os.environ['PATH']
     user = os.environ['USER']
     editor = os.environ['EDITOR']
     ...
     
  • See the Advanced Python Tutorial.
<<< O'Reilly OSCON 2000, Introduction to Python, Slide 113
July 17, 2000, beazley@cs.uchicago.edu
>>>