[Tutor] what does %s do?

michaelbaker@operamail.com michaelbaker@operamail.com
Thu, 25 Jan 2001 22:26:13 -0800


>hi tutors.


I 've been going through some code sent here from arcege (thanks arcege) - 
it works great, but I wonder what %s does??
the code:

 >>> a = [ 'one', 'two', 'three' ]
 >>> dir()
['__builtins__', '__doc__', '__name__', 'a']
 >>> for b in a:
...   exec '%sbuffer = []' % b   #here it is
...
 >>> dir()
['__builtins__', '__doc__', '__name__', 'a', 'b', 'onebuffer', 
'threebuffer', 'twobuffer']
 >>>

as usual, thanks for the help
m baker