#一个函数只做一件事
def my_file(name,content=None): with open(name,'a+') as f: f.seek(0) if content: f.write(content) else: return f.read()