问题描述
有没有更优雅的方法来检查函数输出是否为假? 如果不是,如果函数代价高,第二种方法是否是好的解决方案?
def get_first_last_name(name):
if ' ' not in name:
return False
return name.split()
if get_first_last_name('John Smith'):
first_name,last_name = get_first_last_name('John Smith')
output = get_first_last_name('John Smith')
if output:
first_name,last_name = output
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)