How to convert a list by mapping an element into multiple elements in python?
<p>For example,
how to convert [1, 5, 7] into [1,2,5,6,7,8] into python?
[x, x+1 for x in [1,5,7]] can't work for sure...</p>

<p>A simple way to think about the problem is to make a second list of incremented values and add it to the original list, then sort it:</p>

<pre><code>l = [1, 5, 7]
m = l + [i+1 for i in l]
m.sort()
print m  # [1, 2, 5, 6, 7, 8]
</code></pre>

python