<html>
<body>
At 10:42 AM 8/1/2005, Gilbert Tsang wrote:<br>
<blockquote type=cite class=cite cite="">Hi there,<br><br>
I would like to construct some string objects using the cprintf-style
format:<br><br>
command_string = &quot;diff -u %s %s &gt; %s.patch&quot; % ( src, dst,
file )<br><br>
Of course it is illegal in python </blockquote><br>
How did you conclude that? &quot;diff -u %s %s &gt; %s.patch&quot; % (
src, dst, file ) is a Python expression, and will do what you
want!<br><br>
See
<a href="http://docs.python.org/lib/typesseq-strings.html" eudora="autourl">http://docs.python.org/lib/typesseq-strings.html</a>
for the official documentation.<br><br>
<blockquote type=cite class=cite cite="">but I couldn't figure out a way to <br>
construct strings with that kind of formatting and substitution.<br><br>
I have been looking and couldn't discover string constructor such as<br><br>
command_string = string( &quot;diff -u %s %s &gt; %s.patch&quot; % ( src, dst, file ) )<br><br>
&nbsp;From the documentation on docs.python.org, the closest is string <br>
Template (but my python installation doesn't come with this module). Any <br>
insights on initializing string in this manner?<br><br>
<br>
Thanks, Gilbert.<br>
_______________________________________________<br>
Tutor maillist&nbsp; -&nbsp; Tutor@python.org<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" eudora="autourl">http://mail.python.org/mailman/listinfo/tutor</a> </blockquote>
<x-sigsep><p></x-sigsep>
<font size=2>Bob Gailer<br>
phone 510 978 4454 </font></body>
</html>