[Chicago] constant length string manipulation

Ian Bicking ianb at colorstudy.com
Thu Nov 29 22:45:37 CET 2007


Let's all hop on board!

def fivespaces(s):
     while len(s) < 5:
         s += ' '
     while len(s) > 5:
         s = s[:-1]
     return s

You are welcome!

-- 
Ian Bicking : ianb at colorstudy.com : http://blog.ianbicking.org


More information about the Chicago mailing list