May-07-2019, 11:22 AM
I have a csv file I made some calculation with code function on it. and requesting output is okay write now.
my question is:
should I write the close() at the end of the code? what would be difference when I write that line or I did not write it?
for example:
my question is:
should I write the close() at the end of the code? what would be difference when I write that line or I did not write it?
for example:
with open('grades.csv', 'w', newline='') as output_file_name: writer = csv.writer(output_file_name) writer.writerows(data) output_file_name.close()