2011年1月2日 星期日

IOError: [Errno 9] Bad file descriptor

開啟寫入的檔案,不能拿來讀取
>>> file=open('/tmp/haha.haha','w')
>>> file.read()

Traceback (most recent call last):
File "", line 1, in <module>;
IOError: [Errno 9] Bad file descriptor

>>> file=open('/tmp/haha.haha','w')
>>> for line in file:
>>>     print line

Traceback (most recent call last):
File "", line 1, in <module>
IOError: [Errno 9] Bad file descriptor

**You can't open a writable file for read.

沒有留言: