The question of the type of the data sutructure depends of your use of the data. <br>
You could avoid some confusion without naming your columns "lines"...<br>
<br>
Anyway, here is a piece of code that read the file and count the star on the fly:<br>
(The result is a dict of dict of int.)<br>
<br>
-----------------------------------------------------------------<br>
import itertools<br>
import csv<br>
<br>
f = open("toto.data") #change your file name<br>
lineReader = csv.reader(f)<br>
<br>
#Set the lines titles (RHA280, etc)<br>
l = lineReader.next() <br>
linesTitles = l[2:]<br>
<br>
#We construct the data structure and count the stars on the fly<br>
datas = {}<br>
for l in lineReader:<br>
name, allele = l[:2]<br>
if not allele: #empty line<br>
continue<br>
if name: #new block defining a TD*<br>
currentName = name<br>
d = dict.fromkeys(linesTitles, 0)<br>
datas[currentName] = d<br>
lines = l[2:]<br>
#add 1 to the lines not empty (<=> with a star)<br>
for title, value in itertools.izip(linesTitles,lines): <br>
if value:<br>
d[title] += 1<br>
<br>
#little tests<br>
print datas<br>
print datas["TDF1"]["RHA280"]<br>
print datas["TDF3"]["RHA280"]<br>
-----------------------------------------------------------------------------<br>