how to generalize/get base directory for Linux path for python script
<p>(Linux)in Bash I can use variableName= cd $BASEDIR./Desktop to replace HOME/userName/Destop.  How can I achieve the same in Python?</p>

<p>EXAMPLE:
        need to replace home/name to be generic so that I can run this from multiple hosts.
    f = open("home/name/directory/subdirectory/file.cfg", "r")</p>

<p>Try to use commands libray.</p>

<pre><code>import commands

commands.getoutput("cd $BASEDIR./Desktop")
</code></pre>

python