>>> a = "pithon"
>>> a[1] = y
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
a[1] = y
NameError: name 'y' is not defined
>>> a[1] = 'y'
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
a[1] = 'y'
TypeError: 'str' object does not support item assignment
>>> a[1]
'i'
>>> a[:1] + "y" + a[2:]
'python'
>>>
'python' 카테고리의 다른 글
#positional formationg, #named placeholder (0) | 2020.07.12 |
---|---|
list끼리 + 는 되지만 - 는 안된다? / append , extend 차이 (0) | 2020.06.17 |
sequence of "non-decreasing" numbers (0) | 2020.06.12 |
print odd numbers (1 ~199) (0) | 2020.06.12 |