问题
I am using the function open_workbook() to open an excel file. But I cannot find any function to close the file later in the xlrd module. Is there a way to close the xls file using xlrd? Or is not required at all?
回答1:
Digging into the mailing list archive, it seems that the file object is closed directly by the constructor, so you don't need to close it explicitly.
回答2:
The open_workbook calls the release_resources ( which closes the mmaped file ) before returning.
来源:https://stackoverflow.com/questions/5403781/is-there-a-way-to-close-a-workbook-using-xlrd