I have read a cvs file and I would like to create a dictionary from the information I have on that file. I´ve tried to use class csv.DictReader to that propose but it didnt gave me the results i wanted.
Now i am reading the file like this:
size_reader = csv.reader(f,dialect='excel-tab')
and I have as result this:
['chr1', '249250621']
['chr2', '243199373']
['chr3', '198022430']
['chr4', '191154276']
['chr5', '180915260']
I would like to make a dictionary with this structure:
dict ['chr4'] = 191154276
dict ['chr5'] = 180915260
dict ['chr2'] = 243199373
I tried regular expressions to split the elements the lines on the file but I had no success with it, maybe i used the wrong characters in the split function. Could you give some suggestion of how to separate the elements and built the dictionary?