我有一個字符串,我想提取exon_number這是其間的「」 X「」兩個括號出現後提取數字字符?
我用re.search找到「exon_number」的發生,但我不希望包括在最終的輸出字符串exon_number
實施例:
temp_ID = []
k = '"gene_id ""XLOC_000001""; transcript_id ""TCONS_00000001""; exon_number ""1""; oId ""CUFF.17.1""; tss_id ""TSS1"";"'#input string
temp_ID.append((re.search(r'(exon_number\s""\d"")',k).group(1)))
print temp_ID
>['exon_number ""2""']
desired_output = ['2']
我所要的輸出僅僅是其間所述兩個" "
的值,因爲它可以是一個單一的數字/雙位數字所以我不能SE LECT的[-3]位置
讓我知道如果我需要澄清什麼不同
非常感謝!我很感激。現在有道理 –