title: python - How to use file as a Queue
body: <p>I need to use a file as a <em>Queue</em> but I don't know how to start (also any other aproach is welcome), because I have a non-secure transmission between my device and a computer, and I need all the data to be saved until it is sent and successfully recieved. The DATA is a list which always holds the same type and amount of elements. I imagine something like this to be the file structure:</p>
  
  <pre><code>FILE
  DATA 0 &lt;- send_pointer 
  DATA 1
  DATA 2
  DATA 3 
         &lt;- new_item
  </code></pre>
  
  <p>So the code will look like:</p>
  
  <pre><code>while True:
      DATA = data_gather()
      FILE.write(DATA, new_item)
      new_item += 1
      x = FILE.read(send_pointer)
      if send_function(x):
          FILE.delete(send_pointer)
          send_pointer += 1
      else:
          print('error sending x')
  </code></pre>
  
  <p>I hope you understand my issue, my english is not the best.</p>
  
  <p><strong>EDIT</strong>
  I installed this module: <a href="https://pypi.python.org/pypi/pqueue/0.1.1" rel="nofollow">https://pypi.python.org/pypi/pqueue/0.1.1</a></p>
  
  <p>But I don't know how to use it well. I can't find a way to delete the data I have already read from the file.</p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT 2</strong>
  Solved with pqueue.</p>