If you are doing so many times, it may be worth precomputing the padding for a
given length and adding it by a look up on the length.

For example:
------------------------
SPACE = ' '
MAX = 1000
TAB = 8
paddding = [ SPACE * (n % TAB) for n in range(MAX) ]

.....
s = padding[len(s)] + s
.....
--------------------------
where s is string to be padded

Asokan Pichai

If a language is designed for non-programmers, soon only
non-programs get written in it.                    --- Anonymouse
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to