align on char

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Jun 17 19:58:48 CEST 2004


Suppose you have a sequence of strings, all known to have at least one
occurance of char

lines = (
  'user1 : John Hunter',
  'another user : Bill Bragg',
  'yet on more : Hi There', 
)

what is the best / easiest / most elegant way of producing this?

aligned = (
  'user1        : John Hunter',
  'another user : Bill Bragg',
  'yet on more  : Hi There', 
)

Thanks!
JDH




More information about the Python-list mailing list