In [19]: s = 'abc' In [20]: s Out[20]: 'abc' In [19]: s.ljust(20) Out[19]: 'abc ' In [20]: s.rjust(20) Out[20]: ' abc' In [21]: s.center(20) Out[21]: ' abc ' In [22]: s.ljust(20,'#') Out[22]: 'abc##############' In [23]: s.rjust(20,'#') Out[23]: '##############abc' In [24]: s.center(20,'#') Out[24]: '#######abc#######' In [25]: s1 = s.center(20,'#') In [21]: format? Type: builtin_function_or_method String form: <built-in function format> Namespace: Python builtin Definition: format(value, format_spec) Docstring: Return value.__format__(format_spec) format_spec defaults to the empty string In [22]: format(s,'<20') Out[22]: 'abc ' In [23]: format(s,'>20') Out[23]: ' abc' In [24]: format(s,'^20') Out[24]: ' abc ' d = { "lodDict": 100.0, "SmallCull": 0.04, "DistCull": 500.0, "trilinear": 40, "farcilp": 477 } In [31]: d = { ....: "lodDict": 100.0, ....: "SmallCull": 0.04, ....: "DistCull": 500.0, ....: "trilinear": 40, ....: "farcilp": 477 ....: } In [32]: d Out[32]: {'farcilp': 477, 'lodDict': 100.0, 'SmallCull': 0.04, 'trilinear': 40, 'DistCull': 500.0} In [33]: d.keys() Out[33]: dict_keys(['farcilp', 'lodDict', 'SmallCull', 'trilinear', 'DistCull']) In [34]: map(len,d.keys()) Out[34]: <map at 0xb60402ec> In [35]: list(map(len,d.keys())) Out[35]: [7, 7, 9, 9, 8] In [36]: max(map(len,d.key())) Out[36]: 9 In [37]: w = max(list(map(len,d.keys()))) In [38]: w Out[38]: 9 In [39]: for k,v in d.items(): ....: print(k.ljust(w),':',v) ....: farcilp : 477 lodDict : 100.0 SmallCull : 0.04 trilinear : 40 DistCull : 500.0 In [40]: for k in d: ....: print(k.ljust(w),':',d[k]) ....: farcilp : 477 lodDict : 100.0 SmallCull : 0.04 trilinear : 40 DistCull : 500.0 In [38]: for k in d: ...: print(format(k,'<'+str(w)),':',d[k]) ...: lodDict : 100.0 SmallCull : 0.04 DistCull : 500.0 trilinear : 40 farcilp : 477 In [39]: for k,v in d.items(): ...: print(format(k,'<'+str(w)),':',v) ...: lodDict : 100.0 SmallCull : 0.04 DistCull : 500.0 trilinear : 40 farcilp : 477