Skip to content

Commit 97c4e0d

Browse files
committed
Add new file
1 parent ac64855 commit 97c4e0d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

i_o2.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#When we use With As we done need to call close() because __exit__() built in function takes care of it
2+
with open("text.txt", "w") as my_file:
3+
my_file.write("Yay!")
4+
5+
if my_file.closed == False:
6+
my_file.close()
7+
8+
print my_file.closed

0 commit comments

Comments
 (0)