I am counting the lines in a file using the following:
n = sum(1 for line in open(counts_file_location))
Questions:
- does the file
counts_file_location
gets closed automatically at the end of "for" loop? - if the file does not get closed automatically, how do I close it? There is no file_pointer assigned to to the file.