title: Python delete line and write over it
body: <p>i have proplem here with my code </p>
  
  <p>i am using for loop to save results in txt file</p>
  
  <p>every time i use it it's saving the last line and delete the old line </p>
  
  <p>here is code:</p>
  
  <pre><code>                 for i in domains:
                      requests.get(i)
                          if req.status_code == 200:
                              print('[+]:', i + '/')
                              file = open(save,'w')
                              file.write(domain)
                              file.close()
  </code></pre>
  
  <p>so after run the code it's save the last domain or last results and delete the old results</p>
  
  <p>so i want solution 
  thanks.</p>