[Tutor] Saving and loading data to/from files

Rick Pasotto rick@niof.net
Sun, 3 Jun 2001 11:14:20 -0400


On Sun, Jun 03, 2001 at 02:39:22PM -0000, Daryl G wrote:
> The %s doesn't quite work right. If a name is shorter than another,
> then the positions wont be right in my simple table. I guess I have to
> see if that center() method will work for me.
> 
> example
> LastName        FirstName       Phone#
> Stephanopolis   George          900-856-2992
> Jo   Mary          800-328-6387

Use a width modifier with your %s spec. "%-20s" means to left justify
using at least 20 columns. Just make sure the width you use is as long
as the longest value. You can also use "%-*s" % (width,string) if you
want the width to be dynamic, ie, if you scan the list first to
determine the maximum lengths.

-- 
Is there any need to prove that this odious perversion of the law
is a perpetual cause of hatred, discord, and even social disorder?
Look at the United States. There is no country in the world where
the law confines itself more rigorously to its proper role, which
is to guarantee everyone's liberty and property. Accordingly,
there is no country in which the social order seems to rest on a
more stable foundation. Nevertheless, even in the United States
there are two questions, and only two, which since it was founded,
have several times put the political order in danger. And what are
these two questions? The question of slavery and that of tariffs,
that is, precisely the only two questions concerning which,
contrary to the general spirit of this republic, the law has
assumed a spoiliative character. Slavery is a violation, sanctioned
by law, of the rights of the person. Protective tariffs are a
violation, perpetrated by the law, of the right to property; and
certainly it is remarkable that in the midst of so many other
disputes this twofold legal scourge, a sad heritage from the Old
World, should be the only one that can and perhaps will lead to
the dissolution of the Union. It is, in fact, impossible to
imagine any graver situation in a society than one in which the
law becomes an instrument of injustice. And if this fact gives
rise to such dreadful consequences in the United States, where it
is only exceptional, what must be its consequences in Europe where
it is a principle and a system?
	-- Frédéric Bastiat (1801-1850)
    Rick Pasotto    rickp@telocity.com    http://www.niof.net