Python list indices must be intergers not str?

ok, im not overly sure as to why its giving me this message as it is an interger:

i was making a bit of code that would end as a password locker, the encryption will realy just be taking the askii value of a char in a string from each line in a file and change it up and down depending on how long the password is, this can then be done over and over again, layering the passwords ontop of each other.

<code>

def encrypt(s):
    sCopy=list()
    lenStr=s.__len__()
    s=list(s)
    for x in s:
        sCopy[x]=int(ord(s[x]))
        s[x]=chr(sCopy[x])</code>

thats not all of it so the lenStr may be a bit strange. its the line with sCopy[x]=int(ord(s[x])) that throws the error above, s is a list of strings where ord() is copying and converting them one by one to an interger, i shouldnt need the int() around it but that didnt stop the error either

found the answer

for x in range(s):

not for x in s:

If you're doing this kind of stuff you might be interested in having a read about the caesar cipher (if I understand you correctly is very similar to what you're doing) and substitution ciphers. You can do some pretty cool stuff when it comes to scrambling and unscrambling your data.