Insert char from string into list in one line
<p>I'm after a way to reduce the following code down to one line, I assume through list comprehension. </p>

<pre><code>string = raw_input("String: ")
stringlist = []
for char in string:
    stringlist.insert(0, char)
</code></pre>

<p>So, you basically want to reverse the string and create a list from its reversed version:</p>

<pre><code>stringlist = list(reversed(raw_input("String: ")))
</code></pre>

<p>The following is even shorter, but probably a bit harder to read:</p>

<pre><code>stringlist = list(raw_input("String: ")[::-1])
</code></pre>

<p>This code uses <a href="https://docs.python.org/release/2.3.5/whatsnew/section-slices.html" rel="nofollow">extended slices</a>.</p>

python python-2.7 list-comprehension