python - open() not working with path names
<p>Python 2.7.1, using open(), and having trouble with append mode and pathname instead of filename.</p>

<p>It says open() works as stdio fopen(), and that func when put into append ("a") says it's supposed to create the file if it doesn't exist.</p>

<pre><code># this works in python, creating file.txt if it doesnt exist
&gt;&gt;&gt; fp = open ("file.txt", "a")

# this fails to create, but works if the file is already extant
&gt;&gt;&gt; fp = open ("~/file.txt", "a")
IOError: [Errno 2] No such file or directory: '~/file.txt'
</code></pre>

<p>The problem is being a pathname, not a filename. What am I doing anything wrong?</p>

<p>edit: Linux</p>
