string - Python: print in two columns -
i'm trying print string 2 fixed columns. example, i'd able print:
abc xyz abcde xyz xyz
what correct way format output string when printing achieve this? also, how done before version 2.6 , after version 2.6?
you can use format , mention fix spaces between columns
'{0:10} {1}'.format(s1, s2)
old style formatting
'%-10s' '%s' % (s1,s2)
Comments
Post a Comment