python 类
class w_contacts: def __init__(self, someones_name, someones_phone, someones_job, someones_age): self.name=someones_name self.phone=someones_phone self.job=someones_job self.age=someones_age def save(self): with open('contacts.txt', 'a') as f: f.write("name: {}\nphone: {}\njob: {}\nage: {}".format(self.name, self.phone, self.job, self.age)) def load(self): print("name: {}\nphone: {}\njob: {}\nage: {}".format(self.name, self.phone, self.job, self.age)) contact = w_add_address('www', 123456789, 'DLP', 19) contact.save() contact.load() class w_add_address(w_contacts): def __init__(self, n, p, j,