0
How do I change stringed operators to normal
A=â+â # i have to change strâ+â to normal + Iâve searched what type does normal plus sign have. In order to change str to that type. But canât find them on the internet
7 Respostas
+ 1
the others will require using of objects and methods. in some sense it will be customized "eval". but " eval " is very dangerous, and custom solution could be preferable.
+ 1
in what sense do you want "normal". + is an operator, and cannot be assigned to a variable A=..
+ 1
???
strings are always in " or '.
when you print ("+") it will be +
what is your ultimate goal?
+ 1
fine. one way is
res = eval (str(num[0])+oper[0]+ str(num[1]))
will give you res = 3
0
â+â â> +
0
Operators=[â+â,â-â,â*â]
Numbers=[1,2,3]
I am trying to combine these two
str(Numbers[0])+operators+ str(Numbers[1])
(This equals toâ1+2â)
And then change them to ânot stringâ
In here when i do int(â1+2â) it doesnât work because of the plus
0
Thanks. You said one way is there another way too?