diff --git a/guide/english/python/data-structures/strings/index.md b/guide/english/python/data-structures/strings/index.md index 6855f9fa17..981751568b 100644 --- a/guide/english/python/data-structures/strings/index.md +++ b/guide/english/python/data-structures/strings/index.md @@ -20,7 +20,15 @@ Python allows `str` objects, or _strings_, to be expressed in a few different wa File "", line 1, in TypeError: 'str' object does not support item assignment - + Instead, you can convert the string into a list, modify the list element (string character) you wish to change, and then join the list elements back to a string, like so: + + >>> foo = "my string" + >>> foo_list_form = list(foo) + >>> foo_list_form[0] = "a" + >>> foo = ' '.join(foo_list_form) + >>> print(foo) + ay string # The required output + ## Reference: Text Sequence Type _str_