On Nov 29, 2007, at 4:45 PM, Ian Bicking wrote: > def fivespaces(s): > while len(s) < 5: > s += ' ' > while len(s) > 5: > s = s[:-1] > return s Why not just: return s.ljust(5)[:5] -- Ed Leafe -- http://leafe.com -- http://dabodev.com