title: Python read stuff from file, C++ style
body: <p>I have this C++</p>
  
  <pre><code>int n = 0;
  file &gt;&gt; n;
  
  for (int i = 0; i &lt; n; i++) file &gt;&gt; array[i];
  
  etc.
  </code></pre>
  
  <p>How do i write it succinctly in Python?</p>
  
  <p>This is Python:</p>
  
  <pre><code>string = string.lstrip()
  
  n = 0
  for c in string:
    if not c.isdigit():
      break
    n = n * 10 + int(c)
  
  for i in range(n):
    string = string.lstrip()
    for c in string:
      if not c.isdigit():
        break
      array[i] = array[i] * 10 + int(c)
  </code></pre>
  
  <p>I thought Python was supposed to be more "expressive" than C++.</p>