About 2,460,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. Using python's eval () vs. ast.literal_eval () - Stack Overflow

    174 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, …

  3. 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 …

  4. python - Convert a String representation of a Dictionary to a ...

    >>> help(ast.literal_eval) Help on function literal_eval in module ast: literal_eval(node_or_string) Safely evaluate an expression node or a string containing a Python expression. The string or …

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

    But they are rare. Using eval in your case is a bad practice for sure. I'm emphasizing on bad practice because eval and exec are frequently used in the wrong place. Replying to the …

  6. python - what is the difference between "eval" and "int" - Stack …

    Advice: use int, because it's safer, doesn't have security issues (eval can evaluate any expression, including system calls and file deletion), and suits your purpose perfectly. Note: …

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

    You can use ast.literal_eval(node_or_string) which is safe (ish) in Python 2: Safely evaluate an expression node or a string containing a Python expression. The string or node provided may …

  8. 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 …

  9. Python's eval () and globals () - Stack Overflow

    Python's eval () and globals () Asked 16 years, 8 months ago Modified 9 years, 3 months ago Viewed 23k times

  10. How can I run eval () in the local scope of a function

    I try to use eval() in a local scope of a function. However it always evaluate in the global scope. Self contained examples: 1- This code works: var1 = 1 var2 = 2 var3 = 3 myDict = dict((name,