Home > other >  Questions about the dictionary son key duplicate values
Questions about the dictionary son key duplicate values

Time:10-24

For example, a list [a, b, c], [a, b, d]
How in the list of keys?
Use dict. Setdefault (the list [0], {}) [2] [list] [1]=list are always caused by the repetition of b only last input can save,

CodePudding user response:

What a dictionary key duplicates the son

CodePudding user response:

Did you not save dict. Setdefault (the list [0], {}) [2] [list] [1]=list are processed results!
 
List=[" a ", "b", "c"]
D={} # used to hold a dictionary
D.s etdefault (the list [0] and {}) [2] [list] [1]=list
List=[" a ", "b", "d"]
D.s etdefault (the list [0] and {}) [2] [list] [1]=list
Print (d)
  • Related