Hi there,
I would like to construct some string objects using the cprintf-style format:
command_string = "diff -u %s %s > %s.patch" % ( src, dst, file )
Of course it is illegal in python
How did you conclude that? "diff -u %s %s > %s.patch" % ( src, dst, file ) is a Python _expression_, and will do what you want!
See http://docs.python.org/lib/typesseq-strings.html for the official documentation.
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.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
phone 510 978 4454
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor