Use a list
some_dict={}
for key in ["a", "b", "a", "c", "c"]:
if key not in some_dict:
some_dict[key]=[]
some_dict[key].append(key)
print some_dict
woooee
Posting Maven
2,705 posts since Dec 2006
Reputation Points: 827
Solved Threads: 779
Skill Endorsements: 9
Don't know the structure of your data, but the previous example other way:
data = "abacc"
some_dict={key:[k for k in data if k == key] for key in set(data)}
print some_dict
pyTony
pyMod
6,305 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26