Python open file exception, how do I know detailed exception information?
<p>Question as in code comment.</p>

<pre><code>try:
    with open('file1.txt', 'r') as f1:
        f1.read(...)

    with open('file2.txt', 'rb') as f2:
        f2.read(...)
        f2.write(...)

except IOError as e:
    # How do I know which file throwed the exception? So to report a friendly error message.
    # Further, can I know if the exception is caused by open, read, or write?
</code></pre>