python why i should close file code example
Example 1: In with statement in pyhton should we close the file?
Is a file object "close" statement still needed in the second example, when the "with" statement is being used?
Example 2: do i need to close a file in python3 in with statement
with open('/etc/passwd') as f:
for line in f:
print(line)
# by using with statement u have no need to close the file.it auto exists after its use.