여기 무슨 일 이니?왜 dict [:]을 호출 할 수 없습니까?
>>> a = {1: "a", 2: "b"}
>>> del a[1]
>>> a
{2: 'b'}
>>> a = {1: "a", 2: "b"}
>>> del a[:]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type
>>> a.clear()
>>> a
{}
dict.clear
으로 전화해야하는 이유는 무엇입니까?
'[:]'는'[0 : len (a)]'과 동등한 문서를 링크 할 수 있습니까? –
http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange note (4) – Amber