for file1 in sys.argv[1:]:
filecount+=1
f = open(file1, "r")
linecount=1
for line in f:
if linecount>1:
p = re.search("^(.+),.+", line.strip())
if p:
dict1[p.group(1)].append(filecount)
linecount+=1
for the_key, the_value in dict1.iteritems():
count=''
sys.stdout.write(the_key + ',')
c = collections.Counter(the_value)
for i in range(1,filecount+1):
if count:
count = count + "," + str(c)
else:
count = str(c)
print(count)