Created
September 4, 2013 22:24
-
-
Save podopie/6443639 to your computer and use it in GitHub Desktop.
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
Python 2.7.5 |Anaconda 1.6.1 (x86_64)| (default, Jun 28 2013, 22:20:13) | |
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> 'abc'[1] | |
'b' | |
>>> 'abc'[1] = 'c' | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: 'str' object does not support item assignment | |
>>> array = ['dog', 'cat', 'duck'] | |
>>> array[0] | |
'dog' | |
>>> array[0] = 'pug' | |
>>> array[0] | |
'pug' | |
>>> tups = ('dog', 'cat', 'duck') | |
>>> tups[0] | |
'dog' | |
>>> tups[0] = 'pug' | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: 'tuple' object does not support item assignment | |
>>> someString = 'this is a string! You cant change me!' | |
>>> someString[1] | |
'h' | |
>>> someString[1] = 'd' | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: 'str' object does not support item assignment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment