Guest User

Untitled

a guest
Apr 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  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))
Add Comment
Please, Sign In to add comment