<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#330099">
Glenn Hutchings wrote:
<blockquote cite="mid:loom.20091109T130302-908@post.gmane.org"
 type="cite">
  <pre wrap="">Rob Briggs <rdbriggs <at> mun.ca> writes:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Is there a way to do a repeat formatting command like in Fortran? Rather
that doing this:

print "%s %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f %-5.3f" %
(parmName[i], tmp[i][1], tmp[i][2], tmp[i][4],  tmp[i][6],  tmp[i][7],
tmp[i][8],  tmp[i][9])
    </pre>
  </blockquote>
  <pre wrap=""><!---->
There certainly is.  You can use python's string concatenation
and repeat operators:

print "%s" + " %-5.3f" * 7 % <stuff>

Glenn

  </pre>
</blockquote>
<br>
data = tuple(parmName[i]) + tuple(tmp[i])
<pre wrap="">print "%s" + " %-5.3f" * len(tmp[i]) % data

That should do the trick.

JM
</pre>
</body>
</html>