'What is the Tkinter eval() function?
I am currently building a calculator in Tkinter. I've been searching a few youtube videos to define a few functions and I came across this:
result = eval(self.string.get())
I understand that it is creating a new variable called result that holds the contents of string.get(), but I am unsure what eval() does.
Solution 1:[1]
This takes the string as an expression and determines its value. For instance, the string "3 + 5" would return 8.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Prune |
