2017-02-27 | Paul Boddie | file changeset files shortlog | Merged result class changes. |
paul@347 | 1 | try: |
paul@347 | 2 | f = open("tests/read_file.py") # this file! |
paul@347 | 3 | except IOError, exc: |
paul@347 | 4 | print "I/O error occurred:", exc.value |
paul@347 | 5 | raise |
paul@347 | 6 | |
paul@347 | 7 | try: |
paul@347 | 8 | s = f.read(5) |
paul@347 | 9 | print s # try: |
paul@347 | 10 | s = f.read(49) |
paul@347 | 11 | print s # f = open("tests/read_file.py") # this file! |
paul@436 | 12 | s = f.readline() |
paul@436 | 13 | print s # except IOError, exc: |
paul@347 | 14 | s = f.read() |
paul@347 | 15 | print s |
paul@347 | 16 | finally: |
paul@347 | 17 | f.close() |