title: how to fill a list with 0 using python
body: <p>I want to get a fixed length list from another list like:</p>
  
  <pre><code>a = ['a','b','c']
  b = [0,0,0,0,0,0,0,0,0,0]
  </code></pre>
  
  <p>And I want to get a list like this: <code>['a','b','c',0,0,0,0,0,0,0]</code>. In other words, if <code>len(a) &lt; len(b)</code>, i want to fill up list <code>a</code> with values from list <code>b</code> up to length of the list <code>b</code>, somewhat similar to what <a href="http://docs.python.org/2.7/library/stdtypes.html?highlight=ljust#str.ljust" rel="noreferrer"><code>str.ljust</code></a> does.</p>
  
  <p>This is my code:</p>
  
  <pre><code>a=['a','b','c']
  b = [0 for i in range(5)]
  b = [a[i] for i in b if a[i] else i]
  
  print a
  </code></pre>
  
  <p>But it shows error:</p>
  
  <pre><code>  File "c.py", line 7
      b = [a[i] for i in b if a[i] else i]
                                      ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>What can i do?</p>