title: file is overwriten in python,when open in append mode
body: <p>WriteFile1() Code snip:</p>
  
  <pre><code>try:
      iOutputFile = open(IFilePath, "a")
      if iOutputFile == 0:
          return
  
      csvInfoWriter = csv.writer(iOutputFile,  delimiter=',', lineterminator='\n')
  
      lenBuff = len(g_Hash)
      for value in g_Hash.itervalues():
          iValueLen = len(value)
          for index in range(0, iValueLen):
              csvInfoWriter.writerow(value[index])
  
  
      iOutputFile.close()
  
   except:
      print sys.exc_type
  </code></pre>
  
  <p>I'm reading one files contents, storing those in dict g_Hash.</p>
  
  <p>After reading 1000 records,I'm calling WriteFile1() to write file, and <strong>I do clear contents from dict g_Hash [By calling ClearRec() ].</strong> Everytime I do call WriteFile1() it overwrites my outputfile.</p>
  
  <p>Please help me, I want to append the data, not wanted to overwrite..</p>
  
  <p><strong>Edit:</strong> After removing this from code, still the problem occurs.</p>
  
  <pre><code> if iOutputFile == 0:
          return
  </code></pre>
  
  <p><strong>Update:</strong> </p>
  
  <p>ClearRec() Code:</p>
  
  <pre><code>        WriteFile1()
          g_Hash.clear()
  </code></pre>
  
  <p>----------- Does ClearRec() will cause any problem? --------</p>