I have conditional string like below ,
condition1 = "((2=2) or (3=1)) and (1=1)"
condition2 = "((2=3) or (1=1)) and (4=5)"
Above both condition gives me out-put True and False respectively.
More explanations :
condition1 work as ,
if ((2==2) or (3==1)) and (1==1):
Return True
else:
Return False
Output for condition1 : True
condition2 work as ,
if ((2==3) or (1==1)) and (4==5):
Return True
else:
Return False
Output for condition2 : True
Update :
Sorry Friends,
I have conditional string like above condition1 and condition2.
i want to make function when i parse condition as string and that function perform like if – else and return Boolean value
Please Help…
Thanks
Chintan
Warning: Using
evalis potentially dangerous and you should never eval untrusted input (for example any kind of user input).