A string is just a tuple of characters.
You can do whatever you can do to a tuple to a string.
For example, accessing the elements:
>>> s = "immanuel kant" >>> s[0] 'i' >>> s[1] 'm' >>> s[-3] 'a' >>> s[-10] 'a' >>> s[-9] 'n'
You can also slice a string.
>>> s[:5] 'imman' >>> s[3:7] 'anue' >>> s[:10] 'immanuel k'
However, strings are immutable. So you cannot assign a value to a string’s element.
REXML could not parse this XML/HTML: <pre title="interpreter"> >>> s[8] = 'q' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object does not support item assignment </pre>