name_scr = 'alvinone-90,80,70,50|simonthree-99,80,70,90|theotwo-90,90,90,65' test_scr = {} for persinfo in name_scr.split('|'): name,scores = persinfo.split('-') test_scr[name] = map(int,scores.split(',')) print test_scr