I have a comma delimited string and then a space:
'gene_id EFNB2; Gene_type cDNA_supported; transcript_id EFNB2.aAug10; product_id EFNB2.aAug10;'
I want to create a dictionary in one line, dividing it into separators, but for now I can only go to the list of lists:
filter(None,[x.split() for x in atts.split(';')])
What gives me:
[['gene_id', 'EFNB2'], ['Gene_type', 'cDNA_supported'], ['transcript_id', 'EFNB2.aAug10'], ['product_id', 'EFNB2.aAug10']]
When I want:
{'gene_id': 'EFNB2', 'Gene_type': 'cDNA_supported', 'transcript_id': 'EFNB2.aAug10', 'product_id': 'EFNB2.aAug10'}
I tried:
filter(None,{k:v for k,v in x.split() for x in atts.split(';')})
but it does not give anything. Does anyone know how to do this?
Dave source share