f にはアクセスできるようだ.
>>> with open('/tmp/x.dat', 'w') as f:
... print f
... f.write('hello\n')
...
<open file '/tmp/x.dat', mode 'w' at 0x7f9eaf982c00>
>>> print f
<closed file '/tmp/x.dat', mode 'w' at 0x7f9eaf982c00>
上記は, Python 2.6.6 で試した.
0 件のコメント:
コメントを投稿