In Java, using the close()
method frees resources by removing out of scope objects. I am confused as to what is the Python equivalent for this?
- Does Python's garbage collector automatically do this?
- Is it the
del
method? - Should I use the
with
statement?
Any help will be appreciated.
Edit: My goal is to explicitly remove class objects when desired, not file objects.