On 03 août 11:25, Jürgen Hermann wrote:
> >  '%s' % (a, b)
> >  '%(key)s' % {'ke' : 'value'}
> > 
> > ...
> > 
> > Would someone be aware of something to extract "interpolation 
> > data" from a string?
> > I've to admit I've not took the time to search for such thing...
> 
> Write a class that overloads __getitem__ and record the arguments into an 
> attribute. Then use it like "c = ItemCatcher(); teststring % c". Should be 
> around 10-20 lines of code.
 
huum, clever idea but it may be tricky to deal with 'typed' substitution
strings like %.2f, %d...
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to