mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
16 lines
319 B
Python
16 lines
319 B
Python
f = open("filename")
|
|
... # Actions to perform on file
|
|
f.close()
|
|
# File only closed if actions are completed successfully
|
|
|
|
with open("filename") as f:
|
|
...# Actions to perform on file
|
|
# File always closed
|
|
|
|
f = open("filename")
|
|
try:
|
|
... # Actions to perform on file
|
|
finally:
|
|
f.close()
|
|
# File always closed
|