mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-16 03:34:53 +02:00
Update python.html.markdown
This commit is contained in:
@@ -382,7 +382,7 @@ else: # Optional clause to the try/except block. Must follow all except blocks
|
|||||||
finally: # Execute under all circumstances
|
finally: # Execute under all circumstances
|
||||||
print "We can clean up resources here"
|
print "We can clean up resources here"
|
||||||
|
|
||||||
# Instead of try/finally to cleanup resources you can use with
|
# Instead of try/finally to cleanup resources you can use a with statement
|
||||||
with open("myfile.txt") as f:
|
with open("myfile.txt") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
print line
|
print line
|
||||||
|
Reference in New Issue
Block a user