class A(obejct):
def all_answer(self):
#somecode
for s in br2n.split('\n'):
yield re.sub(re_allmark, '', s)
def save(self, path, pattern):
if not path:
raise 'No path'
else:
with open(path, pattern) as f:
f.write()
大致的效果
a = A()
for each in a.all_answer():
print each #正常返回结果
each.save('/Path/', 'pattern') #保存到文件中
如何让类中all_anser的值传入类中另一个函数呢?