[Tutor] question on string

Gilbert Tsang gtsang at lnxw.com
Mon Aug 1 19:42:08 CEST 2005

Hi there,

I would like to construct some string objects using the cprintf-style 

command_string = "diff -u %s %s > %s.patch" % ( src, dst, file )

Of course it is illegal in python but I couldn't figure out a way to 
construct strings with that kind of formatting and substitution.

I have been looking and couldn't discover string constructor such as

command_string = string( "diff -u %s %s > %s.patch" % ( src, dst, file ) )

 From the documentation on docs.python.org, the closest is string 
Template (but my python installation doesn't come with this module). Any 
insights on initializing string in this manner?

Thanks, Gilbert.

More information about the Tutor mailing list