title: Adding a '\n' to the end of my dictionary when writing it to file
body: <p>I am trying to write my dictionary to a file and already know that I have to change it into a string. However is there any way to add '\n' at the end to keep my file organized?</p>
  
  <p>code is as follows:</p>
  
  <pre><code>def dictionary(grocerystock):
  
      with open('grocery_stock.txt','r+') as f:
          lines = f.readlines()
  
  # filter out empty lines
      lines = [line for line in lines if line.strip() != '']
  
  # split all lines
      lines = [line.split() for line in lines]
  
  # convert to a dictionary
      grocerystock = dict((a, (b, c)) for a, b, c in lines)
  
  # print
      for k, v in grocerystock.items():
          print (k, v)
  
      grocerystock=str(grocerystock)
  
  
      grocerystock=grocerystock.replace("{",'')
      grocerystock=grocerystock.replace("}",'')
      grocerystock=grocerystock.replace("(",'')
      grocerystock=grocerystock.replace(")",'')
      grocerystock=grocerystock.lstrip()
      grocerystock=grocerystock.rstrip()
      grocerystock=grocerystock.strip()
      grocerystock=grocerystock.replace(":",'')
      c=(grocerystock+("\n"))
  
  
      e=open('grocery_stock.txt', 'w+')
  
      e.write(c)
      e.close()
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>