Learning immediately: https://edu.csdn.net/course/play/26755/340159?utm_source=blogtoedu
with the statement ensures that regardless of whether an exception is thrown, it will free up resources. If the statement is used with a custom class, we need to realize __enter__ and __exit__ method, otherwise it will throw an exception