Dynamic construction of a print format string
daniel at dittmar.net
Wed Mar 14 21:04:26 CET 2001
If you want to set some format size dynamically, you can use the *
"%*s" % (namelen, data)
Not quite the asnwer to your question, but maybe the solution to your
Bruce Edge wrote:
> I'm using:
> fmtstr = "%s%s%s" % ( " %", namelen, "s - %s" )
> to get:
> " %19s - %s"
> Is there a better way?
> TIA, Bruce.
More information about the Python-list