python - Create a dictionary/list from a CSV file -
i have sheet , want group dictionary. imported , in comma-separated format
accession,a,b,o,k,g,f 3364,+,-,+,-,+,- 3365,-+,-,+,-,+,- 3366,+,-,-,-,+,+
i want put this:
{'3364': {'a': '+', 'b': '-', 'o': '+','k': '-', 'g': '+', 'f': '-'}}
how can that?
jon right, here hint:
d = {} = '3364,+,-,+,-,+,-' n, *pm = a.split(',') d[n] = {chr(i+65): v i, v in enumerate(pm)} print(d)
Comments
Post a Comment