how to understand os.environ['JOB_ID'] in python -


i have piece of code python.

if _name_ == '_main_':    dir, file = os.path.split("myfile.csv")    out_dir = os.path.join(dir, "myoutput-{0}".format(os.environ['job_id'])) 

i found not easy understand last line, os.environ['job_id'] part. after searching, may belong sge game engine of python. notice in python file, there no statements "import sge". confused. can please help? many time , attention.

an environment variable variable created before python launched , sort of "passed in", though not explicitly. not python specific feature. on command line anywhere have $somename referencing environment variable called "somename". instance path environment variable describes shell programs run.

what means program have been given expecting environment variable called job_id. can set job_id value , run python so:

job_id=my_job_id python my_python_file.py 

if want put spaces in thing put in job_id you'll have put quotes around value part.

with respect python, os.environ['environment_variable_name'] python way of accessing environment variable called "environment_variable_name".


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -