I want to return values from multiple if condition from a same function in python and afterwards want to use all the return values from each if condition. Is it possible????
class Failure():
@staticmethod
def user_failure(input):
bad_char = ['(', ')']
failure_reason = re.findall("(FAIL)(.*)", input)[0][1]
failure_reason = ''.join(
i for i in failure_reason if not i in bad_char).strip()
return failure_reason
def get_failure_reason(self):
result = 'RESULT => FAIL(Failure includes TCs)'
test = 'Test => FAIL (Test log not found)'
if 'FAIL' in result:
result_failure = Failure.user_failure(result)
return result_failure
if 'FAIL' in test:
test_failure = Failure.user_failure(test)
return test_failure
obj = Failure()
output = obj.get_failure_reason()
print(output)
I want both result_failure and test_failure values. Is there a way except creating separate functions for each of them?
Aucun commentaire:
Enregistrer un commentaire