python - how to print contents of PYTHONPATH -


i have set path using

sys.path.insert(1, mypath) 

then, tried print contents of pythonpath variable using os.environ below

print(os.environ['pythonpath']) 

but getting error as

    raise keyerror(key) keyerror: 'pythonpath' 

how can print contents of pythonpath variable.

instead of using os.environ dict, can simple use sys module:

import sys print(sys.path) 

this solution should platform independant. pythonpath key can vary depending on os.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -