I want to convert a string such as '246 + 34'
into an integer such as 246 + 34
. How can I do this? My goal is to print the sum of the equation in the string.
I have tried int('246 + 34')
, but I get the error
ValueError: invalid literal for int() with base 10: '246+34'