補充一點,老師說 tuple 不可變不是絕對的,比如這種 tuple (1, [1, 2]),那么 tuple 可以作為 dict 的 key 也不是絕對的,同上 tuple (1, [1, 2])
2018-06-29
最贊回答 / 慕無忌5445318
For iteration of this game I would recommend this to all the fans who are not to play with the bathroom and bathroom bathroom sink and sink master master bathroom sink sink
2018-06-24
最新回答 / ve0
因為 字典雖然是iterable,但是在迭代的時候,其返回的是key值,而非value值,所以要想使用的是dict的value值,可以像上面說的那樣,使用dict的values(),因為該方法得到的是dict的value值的可迭代對象
2018-04-28
title = ['a', 'b', 'c', 'b', 'c', 'c']
value_count = {}.fromkeys(title, 0)
for a in title:
value_count[a] += 1
print value_count
value_count = {}.fromkeys(title, 0)
for a in title:
value_count[a] += 1
print value_count
2018-04-26
user_dict = {
"name":"bobby",
"age":29,
"height":175,
"edu": "master"
}
user = User._make(user_dict)
的結果是:
age name height edu
"name":"bobby",
"age":29,
"height":175,
"edu": "master"
}
user = User._make(user_dict)
的結果是:
age name height edu
2018-04-19