How to set environment variables for single process

In bash, you simply prefix a command with one or more XXX="YYY" pairs, e.g.

$ A="B" X="Y" python

The code for

import os

for ev in os.environ:
  print "{0}={1}".format(ev, os.environ[ev])

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.