title: Why does my program print an item more than once in a text file?
body: <p>I am having some problems fixing something in my code. When I run the program once, the program causes an item to be printed out more than once on one single line in my text file.</p>
  
  <p><a href="https://i.stack.imgur.com/tG4JD.png" rel="nofollow noreferrer">This is what happens when I run my code. The text file is so the user knows what items need to be restocked</a></p>
  
  <p><a href="https://i.stack.imgur.com/XOXTI.png" rel="nofollow noreferrer">This is my CSV file which is called 'blank file' and is attached to the variable blank. It is where the new stock levels are written</a></p>
  
  <p><a href="https://i.stack.imgur.com/gcW6V.png" rel="nofollow noreferrer">This is my original CSV file which holds all the product information</a></p>
  
  <p>This is my code:</p>
  
  <pre><code>import csv
  data=open('Product information.csv', 'rt')
  purchase=csv.reader(data)
  blank=open('Blank file.csv', 'wt', newline='')
  blank_write=csv.writer(blank)
  reorder=open('Reorders.txt', 'wt')
  
  order=input('Please enter the GTIN-8 code of the product you would like to purchase: ')
  quantity=int(input('Please enter the amount of this product you want to buy: '))
  for row in purchase:
      GTIN=row[0]
      item=row[1]
      price=row[2]
      stock=row[3]
      reorder_level=row[4]
      target_stock=row[5]
      if order==GTIN:
          stock=int(stock)-quantity
      blank_write.writerows([[GTIN,item,price,stock,reorder_level,target_stock]])
  data.close()
  blank.close()
  blank2=open('Blank file.csv', 'rt')
  blank_write2=csv.reader(blank2)
  choice=input('Please enter yes to check the current stock levels: ')
  if choice=='yes':
      for row in blank_write2:
          for field in row:
              GTIN=row[0]
              item=row[1]
              price=row[2]
              stock=int(row[3])
              reorder_level=int(row[4])
              target_stock=int(row[5])
              if stock&lt;=reorder_level:
                  amount_to_restock=target_stock-stock
                  reorder_file=('{} {} {} {} {} {} {}'.format(row[0]+'   ', row[1]+'   ', '{:10.2f}'.format(float(row[2]))+'   ', str(stock)+'   ', str(reorder_level)+'   ', str(target_stock)+'   ', str(amount_to_restock)))
                  reorder.write(reorder_file)
  blank2.close()
  reorder.close()
  </code></pre>
  
  <p>Everything works fine apart from that problem.</p>