List home directory without absolute path
<p>I'm having problem with listing home directory of current user without knowing absolute path to it. I've tried with the following, but it doesn't work:</p>

<pre><code>[root@blackbox source]# python
Python 2.6.6 (r266:84292, Dec  7 2011, 20:38:36)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import os
&gt;&gt;&gt; os.listdir('/root')
['python', '.bashrc', '.viminfo']
&gt;&gt;&gt; os.listdir('~')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
OSError: [Errno 2] No such file or directory: '~'
&gt;&gt;&gt;
</code></pre>
