tests/read_file.py | raw changeset files shortlog |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tests/read_file.py Thu Dec 08 21:45:09 2016 +0100 1.3 @@ -0,0 +1,15 @@ 1.4 +try: 1.5 + f = open("tests/read_file.py") # this file! 1.6 +except IOError, exc: 1.7 + print "I/O error occurred:", exc.value 1.8 + raise 1.9 + 1.10 +try: 1.11 + s = f.read(5) 1.12 + print s # try: 1.13 + s = f.read(49) 1.14 + print s # f = open("tests/read_file.py") # this file! 1.15 + s = f.read() 1.16 + print s 1.17 +finally: 1.18 + f.close()