fork(1) download
  1. def table(lines, delim='\t'):
  2. lens = [len(max(col, key=len)) for col in zip(*lines)]
  3. fmt = delim.join('{:' + str(x) + '}' for x in lens)
  4. return [fmt.format(*line) for line in lines]
  5.  
  6. text = """
  7. start() "hello"
  8. appended() "fly"
  9. instantiated() "destination"
  10. do() "increment"
  11. logging_sampler() "dummy string"
  12. """
  13.  
  14. import re
  15. lines = [re.split(r' ', s.strip(), maxsplit=1) for s in text.strip().splitlines()]
  16. print '\n'.join(table(lines))
  17.  
Success #stdin #stdout 0.01s 7728KB
stdin
Standard input is empty
stdout
start()          	"hello"       
appended()       	"fly"         
instantiated()   	"destination" 
do()             	"increment"   
logging_sampler()	"dummy string"