class File:
name: str
context: str
file: open
def __init__(self, name):
self.name = name
def open(self):
self.file = open(self.name)
def read(self):
return self.file.read()
def write(self, text):
self.file.write(text)
def close(self):
self.file.close()
def __del__(self):
self.file.close()
有疑问加站长微信联系(非本文作者)