I'm trying to automate the resolution of tickets. Indeed, my idea is to parse an input with the format: server_name | alert, and depending of what the server_name and the alert are, execute an action (= function). My first idea was to resolve this with an if/elif block code but starting to code it seemed to me inefficient and long.
if server_name == 'Z':
    if alert == 'a':
        action1()
    elif alert == 'b':
        action2()
        ...
elif server_name == 'Y':
    if alert == 'a':
        action3()
    elif alert == 'b':
        action4()
        ...
...
I did research and creating a grammar seems like a better solution, maybe with re module, ast module or dis module. But the grammars I saw always include math, I just need to evaluate strings. Does anyone know what is best for this situation or do you know if there is a better solution? Thank you.
 
    