[Solved] How can I remove the single quotes from a string and use it for division in Python?


Python has an eval() function that can do this:

a = "https://stackoverflow.com/"
b = "6"
c = "3"
print eval(b + a + c)

However, please note that if you’re getting input from a remote source (like over a network), then passing such code to eval() is potentially very dangerous. It would allow network users to execute arbitrary code on your server.

solved How can I remove the single quotes from a string and use it for division in Python?