ops = {'==': operator.eq, '!=': operator.ne, '<=': operator.le, '>=':
    operator.ge, '>': operator.gt, '<': operator.lt}
maths_operator = '=='
if ops[maths_operator]('test', 'test'):
    print('match found')
maths_operator = '!='
if ops[maths_operator]('test', 'test'):
    print('match found')
else:
    print('match not found')
python if statement with variable mathematical operator