replace %(word) in a string
xnews at fredp.lautre.net
Wed Sep 17 18:30:08 CEST 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
YAFAP : http://www.multimania.com/fredp/
More information about the Python-list