Python: Unable to remove spaces from list
<p>I am trying to remove white spaces from a list of strings in Python.
I have tried almost every other method, but still I am not able to remove the spaces.
Here is the list:</p>

<pre><code>names=[': A slund\n', ': N Brenner and B Jessop and M Jones and G Macleod\n', ': C Boone\n', ': PB Evans\n', ': F Neil utitle: uThe architecture of markets}\n', ': PA Hall and D Soskice\n', '', '', '', '', '', '', '', ': EBYP HIGONNET and DS LANDES and H ROSOVSKY\n', '', '', '', '', '', '', ': DS Landes\n', '', '', '', '', '', '', '', ': DC North\n', '', '', '', '', '', '', '', ': K Polyani\n', '', '', '', '', '', '']
</code></pre>

<p>Here is my code:</p>

<pre><code>for i in names:
    if len(i)== 0:   // i==''  // len(i)&lt;=1
    names.remove(i)
print names
</code></pre>

<p>With list comprehension.</p>

<pre><code>names_without_space = [name.replace(' ', '') for name in names]
print(names_without_space[:3])
# [':Aslund\n', ':NBrennerandBJessopandMJonesandGMacleod\n', ':CBoone\n']
</code></pre>

python list spaces