Allow arrow keys to move cursor when collecting standard input
<p>How do you allow the arrow keys to move the cursor when collecting standard input from Python script? For example</p>

<pre><code>$ python
Python 2.6.6 (r266:84292, Aug 28 2012, 10:55:56) 
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; x = raw_input("testing: ") # arrow keys work in the interpreter
testing: asdasd
&gt;&gt;&gt; exit()
$ cat test.py 
#!/usr/bin/env python

x = raw_input("testing: ")
print x
$ python test.py # arrow keys do not work from a script
testing: asd^[[D^[[D^[[D
asd
</code></pre>
