Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- outerLocal = "foo"
- def innerMethod(innerParam):
- # locals() will not work here
- print("%(outerParam)s %(outerLocal) %(innerParam)" %locals())
- >>> def foo(var):
- ... car=3
- ... print '%(var)s %(car)s' % locals()
- ...
- >>> foo(123)
- 123 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement