fork(8) download
  1. import re
  2.  
  3. text = """"
  4. \nword1 meanings
  5. \nword123 measings
  6. \nword12345 meanings
  7. """
  8.  
  9. maxLen = len(max(re.findall(r"^\S+", text, re.M), key=len))
  10. result = re.sub(r"(\S+)[^\S\r\n]+", lambda m: m.group(1) + ((maxLen + 1) - len(m.group(1))) * " ", text)
  11. print(result)
  12.  
Success #stdin #stdout 0.02s 9332KB
stdin
Standard input is empty
stdout
"

word1     meanings

word123   measings

word12345 meanings