About 2,180,000 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.

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

    Nov 22, 2014 · eval() will allow malicious data to compromise your entire system, kill your cat, eat your dog and make love to your wife. There was recently a thread about how to do this kind of …

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

    Feb 8, 2010 · 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 difference …

  4. 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, …

  5. python - How to convert string representation of list to a list

    ast.literal_eval is safer than eval, but it's not actually safe. As recent versions of the docs explain: "Warning It is possible to crash the Python interpreter with a sufficiently large/complex string …

  6. python - How to un-escape a backslash-escaped string? - Stack …

    Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, numbers, tuples, …

  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. python - Convert a String representation of a Dictionary to a ...

    Some other examples where literal_eval or json.loads fails but asteval works. If you have the string representation of numpy objects and if numpy is installed on your system, then it's much …

  9. 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() …

  10. Using python's eval () vs. ast.literal_eval () - Stack Overflow

    173 ast.literal_eval() only considers a small subset of Python's syntax to be valid: The string or node provided may only consist of the following Python literal structures: strings, bytes, …