I used defaultdic to store some variables but the output is blank
Peter Otten
__peter__ at web.de
Sun Jun 9 08:46:44 EDT 2013
claire morandin wrote:
> Thanks Peter, true I did not realize that ercc_contigs is empty, but I am
> not sure how to "populate" the dictionary if I only have one column for
> the value but no key
You could use a "dummy value"
ercc_contigs = {}
for line in open('Faq_ERCC_contigs_name.txt'):
gene = line.split()[0]
ercc_contigs[gene] = None
but a better approach is to use a set instead of a dict:
ercc_contigs = set()
for line in open('Faq_ERCC_contigs_name.txt'):
gene = line.split()[0]
ercc_contigs.add(gene)
More information about the Python-list
mailing list