$ cat foo.py a = 'hoge' b = 'fuga' print 'foobar %s %s' % (a, b) print 'foobar %(a)s %(b)s' % locals() $ python foo.py foobar hoge fuga foobar hoge fuga
$ cat foo.py a = 'hoge' b = 'fuga' print 'foobar %s %s' % (a, b) print 'foobar %(a)s %(b)s' % locals() $ python foo.py foobar hoge fuga foobar hoge fuga