0

is there any way to read the .bash_profile using python? I need to get value of one of variables, like:

export JAVA_HOME=/usr/java
1
  • 1
    os.environ['JAVA_HOME'] Commented Jun 13, 2014 at 12:51

1 Answer 1

4

If you are looking for the value of a particular environment variable, there is no need to parse .bash_profile. Just check in os.environ.

import os
os.environ['JAVA_HOME']
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.