How do I set characters in a Python string?
<p>I have a function that decrements a whole number parameter represented by a string. For instance, if I pass in the string "100", it should return "99."</p>

<pre><code>def dec(s):
    i = len(s) - 1
    myString = ""
    while (i &gt;= 0):
        if s[i] == '0':
            s[i] = '9'
            i -= 1
        else:
            s[i] = chr(int(s[i]) - 1)
            break
    return s
</code></pre>

<p>However, Python issues this error.</p>

<pre><code>s[i] = '9'
TypeError: 'str' object does not support item assignment 
</code></pre>

<p>I am assuming that <code>s[i]</code> cannot be treated as an lvalue. What is a solution around this?</p>
