About 52,900 results
Open links in new tab
  1. What does Python's eval() do? - Stack Overflow

    Eval function try to execute and interpret the string (argument) passed to it as python code. x=1 print (eval ('x+1')) Output of the above code will be 2. The disadvantage of such approach is …

  2. python - Why is using 'eval' a bad practice? - Stack Overflow

    When confronted with the "eval is a security hole", you can only assume that it's a security hole in the hands of sociopaths. Ordinary programmers merely modify the existing Python source and …

  3. dynamic - Use of eval in Python - Stack Overflow

    Oct 30, 2023 · In the past I have used eval () to add a debugging interface to my application. I created a telnet service which dropped you into the environment of the running application. …

  4. How can I assign the value of a variable using eval in python?

    Apr 8, 2011 · By the way, there are many ways to avoid using exec / eval if all you need is a dynamic name to assign, e.g. you could use a dictionary, the setattr function, or the locals() …

  5. Python: make eval safe - Stack Overflow

    Aug 18, 2010 · If you're satisfied with plain expressions using elementary-type literals only, use ast.literal_eval -- that's what it's for! For anything fancier, I recommend a parsing package, …

  6. Security of Python's eval() on untrusted strings? - Stack Overflow

    Nov 22, 2014 · You can get to os using builtin functions: __import__('os'). For python 2.6+, the ast module may help; in particular ast.literal_eval, although it depends on exactly what you want to …

  7. Dynamically evaluate an expression from a formula in Pandas

    With Python backend, your expression is evaluated similar to just passing the expression to Python's eval function. You have the flexibility of doing more inside expressions, such as string …

  8. What's the difference between eval, exec, and compile?

    Nov 16, 2017 · I've been looking at dynamic evaluation of Python code, and come across the eval() and compile() functions, and the exec statement. Can someone please explain the …

  9. python - How to use eval () function with a list of variables? - Stack ...

    Jan 28, 2019 · For example, in the example above x is defined as 1, so then the eval() function can use it. But I have my variables in a list, not defined as a variable in the scope of my …

  10. Python 3 - exec() Vs eval() - Expression evaluation - Stack Overflow

    Jun 22, 2017 · Question: Expression is a computation that evaluates to a value To evaluate any expression in python (in my case print(5+10) from above python code), How eval() works …

Refresh