Advertisement
Guest User

sol1

a guest
Jan 8th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. if __name__=="__main__":
  2.     result = {}
  3.     for line in open('data.ini'):
  4.         result.update( dict([(a.strip(), b.strip()) for a,b in [y.split('=',1) for y in [x.strip() for x in line.split(',') if x.strip()] if '=' in y ]]) )    
  5.         result.update( dict([(a.strip(), b.strip()) for a,b in [(y,'0') for y in [x.strip() for x in line.split(',') if x.strip()] if '=' not in y ]]) )
  6.     print result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement