Proper number alignment

Daniel Fackrell dfackrell at DELETETHIS.linuxmail.org
Thu Jun 20 14:09:12 EDT 2002


I would avoid tabs altogether and figure out how many spaces I needed to get
there (tab stops can be set differently for every terminal).  Basically,
subtract the total length of the two strings from the total width you want
to fill, and use (' '*numberOfSpaces) as your filler.

--
Daniel Fackrell (dfackrell at linuxmail.org)
When we attempt the impossible, we can experience true growth.

"mdk" <mdk at mdk.com> wrote in message
news:aet5hu$9leln$1 at ID-98166.news.dfncis.de...
> I am using \t\t (tabs) to align these numbers (disregard the math):
>
> Total RAM                2,141,056
> Available RAM            12,934,032
> Used RAM                 1,024
>
> But they are left justified and I need them right justified.
>
> Any ideas?
>
> Thanks.





More information about the Python-list mailing list