title: Python 3 will not read appended data to file
body: <p>I am trying to write binary data to a file. the program will check first if the file exists. If the file does not exist, the program will create the file and write data into it. While if it does exist the data will be appended to the file. Yet, when ever i try to read the file I cannot read the appanded data only the data written when the file was first created.</p>
  
  <pre><code>def getText(self):
      self.readKey()
      st = self.inBox.get('1.0', 'end')
  
      fen = Fernet(self.readKey())
      encrypted = fen.encrypt(st.encode())
      return encrypted
  
  def writeFile(self):
  
      if (os.path.exists('data.txt') == False):
          file = open('data.txt',mode='wb' )
          file.write(self.getText())
          file.close()
      else:
          file = open('data.txt',mode='ab' )
          #sts = file.read()
  
  
          file.write(self.getText())
          file.close()
  
  
      self.inBox.delete('1.0','end')
  
  
  
  
  def openFile(self):
      self.outBox.delete('1.0','end')
  
      fen = Fernet(self.readKey())     
  
      try:
          f = open("data.txt", mode='rb')
      except:
          alert_popup(self,'Error','No File Exists')
  
  
      self.outBox.insert(tk.END, fen.decrypt(f.read()))
  </code></pre>