Practice Problems in Python: files never closed

Many problems involve opening a file like that: file=open('input.csv'), but I don’t see that it gets ever closed like this: file.close(). There is no error generated, but is it a good practice ? Thanks.

If you’re opening files to read, there’s usually not a big deal with not closing them, although I agree that it’s probably best practice to do so.

We’ve chosen to skip this for simplicity in our early Python content, which is why you don’t see it in practice problems.