1

I have a file with content as shown below:

label:SMVRMIGBNTRH_NVGRGNR_MFE_GRG_MO_EKR_WE@0

label: ABCDE_FG_0_0@0,ABCDE_FG_1_1_0@8,_EF_0_0@9,ADDRTGG_0_@11,_PGT_KOCPGF_0__@25

label: FKRIG_DW_FERYRH_GMRE_WW_HT_HE@0

label: ABCDE_FG1_2_0@0,ABCDE_FG_1_2_0@8,_EF_2_0@9,ADDRTGG_2_@9,ADDE_HEM_2_0@13,KOCPGFEL_2_0@14

label: ABCDE_FG_3_0@12,ABCDE_FG_1_3_0@8,_EFTG_3_0@9,ADDRT_3_0@11,CPGF_0__@25

How to just get the number after @ for label 2,3,4 and print in a list?

Desired Output :
[0,8,11,25]
[0,8,9,9,13,14]
[12,8,9,11,25]

The following is the coding I have been working on and it did not get desired output

f=open('file.txt','r')
for line in f:
    line=line.rstrip()
    label=re.findall(r'label:(.*\d),(.*\d)',line)
    for item in label :
        bits=re.findall(r'label:.*?@(\d+)',line)
        if len(bits)>0:
            print bits


Output:
['0']
['0']
['12']
Michelle S
  • 19
  • 3

0 Answers0