title: I'm trying to export a Python list to a .txt file, but the text file ends up having too few lines
body: <p>I have a list (List) of 4196 elements, all equal to either -1 or 1. I want to export the list to a .txt file. Here's the code I used:</p>
  
  <pre><code>file = open('file.txt','w')
  for item in List:
       print&gt;&gt;file, item
  </code></pre>
  
  <p>For some reason, the .txt file only has 2870 elements.  (The same thing happened when I tried another way of exporting the list, but I know there are 4196 elements!)</p>
  
  <p>Thanks for any help,</p>
  
  <p>Zach</p>