Created
November 12, 2015 20:44
-
-
Save meepoSenpai/21d3aba833771cdb190e to your computer and use it in GitHub Desktop.
dictlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def addtolistindict(key, comparelist,dictlist): | |
for elem in comparelist: | |
if elem[0] == key: | |
dictlist.append(elem[1]) | |
#Man, sieht,dass das ganze Strings an Listen in einem Dictionary anhängen soll | |
# In etwa so: | |
comparelist = [['A', 2],['B',3]] | |
somedict = {'A':[],'B':[]} | |
for key in somedict.keys(): | |
addtolistindict(key, comparelist, somedict[key]) | |
print(somedict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment