Use xrange() instead of range().
Avoid too many string operations. The following scripts provide the same output:
# This script takes 2.5 seconds. s = ""
for c in 'A'*50000:
s += str(ord(c)) + ', ' print '[' + s[:-2] + ']'
# This script takes 0.1 seconds. print map(ord, 'A'*50000)