Thread
:
Anyone know how to code Python?
View Single Post
12-06-2012, 11:25 PM
#
8
FlamesPuck12
First Line Centre
Join Date: Apr 2007
Exp:
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
View Public Profile
Send a private message to FlamesPuck12
Find More Posts by FlamesPuck12