replace %(word) in a string
Fred Pacquier
xnews at fredp.lautre.net
Wed Sep 17 12:30:08 EDT 2003
Mirko Zeibig <mirko-lists at zeibig.net> said :
> Especially useful together with the locals() function, which returns a
> dictionary of locally defined variables:
>
> def foo():
> a = "Hello"
> b = "World"
> print "%(a)s %(b)s" % locals()
Yes, that's a wonderful feature. Recently though, I've wondered a couple of
times : is there an easy way to substitute with both local AND global
variables ?...
--
YAFAP : http://www.multimania.com/fredp/
More information about the Python-list
mailing list