What's the advantage of closing a file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the advantage of closing a file?

17th Jul 2016, 3:00 PM
Joel Begley
Joel Begley - avatar
2 Answers
0
One should always close the files that were opened previously as python executes the program in small modules. It makes error debugging easy
18th Jul 2016, 1:50 PM
Shruti Iyengar
Shruti Iyengar - avatar
0
Closing files you free resources like memory and file system. For example, if you open a file to write it locked to prevent others modification at same time. When close the file it unlocked to allow others modifications
19th Jul 2016, 3:07 PM
Jan Sorak
Jan Sorak - avatar