python中怎么调用上一函数的返回值?

我想从第一个函数返回一个获取的title,传入到第二个函数中,作为文件夹的名称,但不懂第二个函数怎么获得第一个函数的返回值(现在第二个函数的dir_path是我事先建好的)
def get_folder_name(html):
file_name = re.compile('<h4>(.*?)</h4>')
name = re.findall(file_name, html)
name1 = ','.join(name)
return name1

def save_image(content):
dir_path = 'G:\\jiepai\\街拍'
file_path = '{0}/{1}.{2}'.format(dir_path, md5(content).hexdigest(), 'jpg')
if not os.path.exists(file_path):
with open(file_path, 'wb') as f:
f.write(content)
f.close()

修改函数定义为save_image(content, dir_path),调用时传递实际路径作为参数。
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答