diff options
| author | Martin Fischer <martin@push-f.com> | 2022-02-27 06:41:42 +0100 | 
|---|---|---|
| committer | Martin Fischer <martin@push-f.com> | 2022-02-27 06:41:42 +0100 | 
| commit | f752a8559959733f2224e92c8a86b512278371f9 (patch) | |
| tree | 8f15f60c243cf9002206dff8b1a4d28da534c230 /puzzles | |
| parent | 4e2ba920f748a7ba7dd25b146bc9880cbae71a4e (diff) | |
update seq_try_except_finally puzzle
Diffstat (limited to 'puzzles')
| -rw-r--r-- | puzzles/seq_try_except_finally.py | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/puzzles/seq_try_except_finally.py b/puzzles/seq_try_except_finally.py index d63ab10..ea17a16 100644 --- a/puzzles/seq_try_except_finally.py +++ b/puzzles/seq_try_except_finally.py @@ -1,8 +1,11 @@ -def foo() -> None: +def f() -> None:      file = None      try:          file = open('test.json')      except Exception:          return None      finally: -        file.name # error +        if file: +            file.close() + +    file.name | 
