Python string modified given: TypeError: 'str' object does not support item assignment

 Python want to modify the last character in the string, using the name [-1] = 'e' to achieve, given run.

Content is error: TypeError: 'str' object does not support item assignment

 Error analysis of content: Modify the string is not supported

Summary: String Once created, the elements of which can not be amended. However, re-assignment is possible, for example: name = 'xiaobai'.

Guess you like

Origin www.cnblogs.com/yyl6/p/11314540.html