There is another issue, and that is that the file itself might be leaked and only reclaimed late or even never by the garbage collector. Therefore, use a with-statement:
with open(...) as file:
data = file.read()
This is hard to digest for anyone with a C-ish background (C, C++, Java, C# and probably others) because the indention there always creates a new scope and any variables declared in that scope is inaccessible to the outside. In Python this is simply not the case, but you have to get used to this style first...