View Single Post
Old 12-06-2012, 11:25 PM   #8
FlamesPuck12
First Line Centre
 
Join Date: Apr 2007
Exp:
Default

Late to the party but here's my contribution. I don't like using the imperative approach to solve this problem in Python.

Try using the dictionary constructor for this problem.

d = dict(line.strip().split(' community ') for line in open('data.txt'))
FlamesPuck12 is offline   Reply With Quote