I have a large list of elements
a = [['qc1l1.1',
'qc1r2.1',
'qc1r3.1',
'qc2r1.1',
'qc2r2.1',
'qt1.1',
'qc3.1',
'qc4.1',
'qc5.1',
'qc6.1',.................]
From this list i want to extract several sublists for elements start with the letters "qfg1" "qdg2" "qf3" "qd1" and so on.
such that:
list1 = ['qfg1.1', 'qfg1.2',....]
list2 = ['qfg2.1', 'qfg2.2',,,]
I tried to do:
list1 = []
for i in all_quads_names:
if i in ['qfg']:
list1.append(i)
but it gives an empty lists, how can i do this without the need of doing loops as its a very large list.