diff options
Diffstat (limited to 'tests/source/space.py')
-rwxr-xr-x | tests/source/space.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/tests/source/space.py b/tests/source/space.py index f1baff9..f465eab 100755 --- a/tests/source/space.py +++ b/tests/source/space.py @@ -9,19 +9,22 @@ import sys def crapspace(fname): chars = True - fp = open(fname, "r") - line = fp.readline() - while line: - line = line.rstrip() - if line: - chars = True - print line - else: - if chars: - print "" - chars = False - + try: + fp = open(fname, "r") line = fp.readline() + while line: + line = line.rstrip() + if line: + chars = True + print(line) + else: + if chars: + print("") + chars = False + + line = fp.readline() + finally: + fp.close() if __name__ == "__main__": if len(sys.argv) < 2: |