Flush and close the IO object. This method has no effect if the file is already closed.
(self)
| 385 | __closed = False |
| 386 | |
| 387 | def close(self): |
| 388 | """Flush and close the IO object. |
| 389 | |
| 390 | This method has no effect if the file is already closed. |
| 391 | """ |
| 392 | if not self.__closed: |
| 393 | try: |
| 394 | self.flush() |
| 395 | finally: |
| 396 | self.__closed = True |
| 397 | |
| 398 | def __del__(self): |
| 399 | """Destructor. Calls close().""" |