WriteFile1() Code snip:
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
I'm reading one files contents, storing those in dict g_Hash.
After reading 1000 records,I'm calling WriteFile1() to write file, and I do clear contents from dict g_Hash [By calling ClearRec() ]. Everytime I do call WriteFile1() it overwrites my outputfile.
Please help me, I want to append the data, not wanted to overwrite..
Edit: After removing this from code, still the problem occurs.
if iOutputFile == 0:
return
Update:
ClearRec() Code:
WriteFile1()
g_Hash.clear()
----------- Does ClearRec() will cause any problem? --------