📜  python代码示例中的fromkeys

📅  最后修改于: 2022-03-11 14:45:18.502000             🧑  作者: Mango

代码示例1
sequence1={1,2,3}
sequence2={"a","b","c"}
values1="Numbers"
values2="Alphabets"
dict1.fromkeys(sequence1,values1)
#returns {1: 'Numbers', 2: 'Numbers', 3: 'Numbers'}

dict2.fromkeys(sequence2,values2)
#returns {'c': 'Alphabets', 'b': 'Alphabets', 'a': 'Alphabets'}