Added support for closing files and streams.
Made the low-level write operation return the number of bytes written, also
declaring the IOError that can be raised.
1try: 2f=open("tests/read_file.py")# this file! 3exceptIOError,exc: 4print"I/O error occurred:",exc.value 5raise 6 7try: 8s=f.read(5) 9prints# try: 10s=f.read(49) 11prints# f = open("tests/read_file.py") # this file! 12s=f.read() 13prints 14finally: 15f.close()