the following is my question:
data = ['a1_1 00000001\n', 'a1_2 00000002\n', 'a1_3 00000003\n',
'b1_1 00000004\n', 'b1_2 00000005\n', 'b1_3 00000006']
candidate = ['a', 'b']
for i in candidate:
for j in data:
if i in j.split()[0]:
print i, j.split()[1]
a 00000001
a 00000002
a 00000003
b 00000004
b 00000005
b 00000006
But what I want to do is to make the result like the following:
a 00000001, 00000002, 00000003
b 00000004, 00000005, 00000006
How do I solve this problem? Thanks in advance!