# creating a dictonary in Python

From the FASTA header I get the following information:

gi|1543850138|ref|NC_040192.1| Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence
['gi', '1543850138', 'ref', 'NC_040192.1', ' Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence']


Is there a better way to create a dictonary as I did with the below script?

from Bio import SeqIO

organismInfo = {}
for seq_record in SeqIO.parse("data/landplantsviruses.fasta","fasta"):
print(seq_record.description)
temp = seq_record.description.split('|')
print(temp)
organismID = temp[3]
organismName = temp[4].lstrip()
print(organismID, organismName)
organismInfo[organismID] = organismName
print(organismInfo)
$$$$


About coding, one write something in a code golf format, but this is problematic as it is hard to interpret and adapt, i.e. it's a bad practice. Having said that if made a list of keys you could use zip with your list of elements as the list of keys may be more intelligible.
header = 'gi|1543850138|ref|NC_040192.1| Desmodium mottle virus isolate UG5 segment DNA-B, complete sequence'
`