daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dic = {'a': 1, 'ab': 2, 'abc': 3}
  2. width = max([len(k) for k in dic.keys()])
  3.  
  4. with open('file', 'w') as file:
  5.     for k, v in dic.items():
  6.         file.write('{0:{width}}\t{1}\n'.format(k, v, width = width))
RAW Paste Data
Top