justifying text...and also...correct use of classes...
craig at postnewspapers.com.au
Thu Dec 30 09:20:06 CET 2004
On Thu, 2004-12-30 at 10:39, Ross La Haye wrote:
[snip code listing]
> Is the way I've used the "Combin" class considered correct/appropriate in
> the "binprob" method? If not, what is the standard usage?
I'm afraid I have no idea what that's about, so I'll have to pass on
> Also, I'm trying to get my results to print close to this(.i.e., I would
> like the first column to be right justified and the second column to be
> exactly as it is):
> I feel like I'm missing something obvious here and apologize in advance if I
> am, but I just can't figure it out.
"%20s: %s" % (leftstring, rightstring)
"%20s: %-40s" % (leftstring, rightstring)
That's Python's 'printf' style string formatting.
More information about the Python-list