[_] Python Question
Andy Gale
andy at mentalist.co.uk
Thu Dec 17 15:51:56 GMT 2009
Hi _,
I know there's a few Python goons on here so... is there a better way
of doing this in Python?
attributes = {}
attribute_data = mark.fetchall()
for i in attribute_data:
if i[1] in attributes:
attributes[i[1]].append(i[0])
else:
attributes[i[1]] = [i[0]]
Given my experience with Python so far, there is probably some epic
shortcut for doing this.
Cheers,
Andy
--
Andy Gale
W: andy-gale.com
T: http://twitter.com/andygale