String interpolation question

Fernando Pérez fperez528 at yahoo.com
Mon Apr 15 17:55:41 EDT 2002


Alex Martelli wrote:

> If you're a string-interpolation junky:
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66018
> 
> and particularly Skip Montanaro's variant (acknowledgedly inspired
> by a post by Steve Majewski) may be to your taste.  With that:
> 
>         print "%$(y[i])s" % Eval()
> 
> works basically as you wish (I could quibble with a few details, but
> it would be quibbling).

Thanks! Very nice, and now that you mention it, I _had_ that bookmarked but 
had forgotten it. I'm now using Skip's variant. I still feel that here perl's 
syntax is cleaner, but that argument is getting old, so I'll shut up ;)

Regards,

Fernando.



More information about the Python-list mailing list