How to convert ascii codes to text?
<p>I need to be able to take an input, remove special characters, make all capital letters lowercase, convert to ascii code with an offset of 5 and then convert those now offset values back to characters to form a word. I keep getting TypeError: 'int' object is not iterable at the end </p>

<pre><code>string=(str(raw_input("The code is:")))

#change it to lower case 
string_lowercase=string.lower()

print "lower case string is:", string_lowercase

#strip special characters

specialcharacters="1234567890~`!@#$%^&amp;*()_-+={[}]|\:;'&lt;,&gt;.?/"

for char in specialcharacters:
    string_lowercase=string_lowercase.replace(char,"")

print "With the specials stripped out the string is:", string_lowercase

#input offset

offset=(int(raw_input("enter offset:")))

#converstion of text to ASCII code 

for i in string_lowercase:
    code=ord(i)
    result=code-offset

#converstion from ASCII code to text
for number in result:
    message=repre(unichr(number))
    print message
</code></pre>

<p>You are getting <code>TypeError: 'int' object is not iterable at the end</code> because you are declaring <code>result</code> each time over the loop as an int. <code>result</code> should be a list and every code appended to it over the loop, like this:</p>

<pre><code>#converstion of text to ASCII code 
result = []
for i in string_lowercase:
    code=ord(i)
    result.append(code-offset)
</code></pre>

python ascii