I have a list which contains string values taht represents calculations. From them I want to get a specific character, let's say plus and minus signs.
I tried using var1.find('a') != -1 or var.find('z') != -1
as suggested here Python: Using AND and OR with .FIND() method, but I'm still getting -1 when I try '-'.
Example:
lists = ["22 + 13", "4500 - 2"]
for list in lists :
if (list.find('+') or (list.find('-')) != -1) :
signpos = list.find("+") or list.find("-")
print(signpos)
else:
print('Error')
I get 3
aand -1
as results, where the desire output should be 3
and 5
.
What I'm not seeing?