[Solved] How to fetch date and time


You can use this function to check if an error exists:

def checkError(Str):
    if 'ERROR' in Str:
        openBracket = Str.find('(')+1
        closedBracket = Str.find(')')
        status = "".join(Str[openBracket:closedBracket])
        error = "\n".join(['YES',", ".join(Str.split('\n\n')[2].split(', ')[1:]),status])
        return error
    else:
        return 'No errors found.'

error = checkError(Str)
print(error)

Output:

YES
22:17:31 Wed Feb 11, 2015
software ERROR

0

solved How to fetch date and time