Advertisement
Guest User

Untitled

a guest
Dec 17th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. >>> exec("x=3")
  2. >>> x
  3. 3
  4. >>> def foo():
  5. ...     exec("blah=4")
  6. ...     print(blah)
  7. ...
  8. >>> foo()
  9. Traceback (most recent call last):
  10.   File "<stdin>", line 1, in <module>
  11.   File "<stdin>", line 3, in foo
  12. NameError: global name 'blah' is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement