Last active
December 19, 2015 06:19
-
-
Save 0xBADDCAFE/5910955 to your computer and use it in GitHub Desktop.
computer_science room #Lingr
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
''' | |
[_] 0286 s_of_p 6 hours ago chap2を読んで試して考えよ: dictのkeyにlistを用いると何が起こるのか? (by bgnori) | |
''' | |
Python 3.3.2 (default, Jul 2 2013, 19:41:05) | |
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> a_dict={'a':1, 'b':2, 'c':3} | |
>>> a_dict | |
{'a': 1, 'b': 2, 'c': 3} | |
>>> a_dict['append']=4 | |
>>> a_dict | |
{'a': 1, 'b': 2, 'c': 3, 'append': 4} | |
>>> a_dict[[1,2,3]]='todo 286' | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: unhashable type: 'list' | |
>>> a_dict={[1,2,3]:'test'} | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: unhashable type: 'list' | |
>>> a_dict={'todo286':'test'} | |
>>> a_dict | |
{'todo286': 'test'} | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment