I’m working with django, and I’m iterating over a list of different keys,
Now per key i want to write some things to a file, so I get the objects by key. like:
for ids in Idlist:
try:
Loci = Locus.objects.get(Gen_ID=ids)
except:
#no locus info found
pass
try:
Itag = Itag_annotatie.objects.get(Gen_ID=ids)
except:
#no Itag info found
pass
try:
Ncbi = NCBI.objects.get(Gen_ID=ids)
except:
#No NCBI info found
pass
writer.writerow([Itag.Gen_ID, Itag.Solyc, Ncbi.defname, Loci.Lociname])
(example code)
How do I empty the object after each writerow?
every key is different.
(didn’t create database with django, Implemented my own database)
So I want to empy the object Instance in Python, but NOT delete the information from the database
Henkes
edit: I want to empty the Ncbi, Loci and Itag objects.
You can set them to
Noneat the beginning of for loop: