title: Read from file and write to another python
body: <p>I have a file with contents as given below,<br></p>
  
  <pre><code>to-56  Olive  850.00  10 10
  to-78  Sauce  950.00  25 20
  to-65  Green  100.00   6 10
  </code></pre>
  
  <p>If the 4th column of data is less than or equal to the 5th column, the data should be written to a second file.<br>
  I tried the following code, but only 'to-56 Olive' is saved in the second file. I can't figure out what I'm doing wrong here.</p>
  
  <pre><code>file1=open("inventory.txt","r")
  file2=open("purchasing.txt","w")
  data=file1.readline()
  for line in file1:
  
      items=data.strip()
      item=items.split()
  
      qty=int(item[3])
      reorder=int(item[4])
  
      if qty&lt;=reorder:
          file2.write(item[0]+"\t"+item[1]+"\n")
  
  
  file1.close()
  file2.close()
  </code></pre>