擅长:python、mysql、java
<p>要在两者之间进行匹配,可以尝试以下操作:</p>
<pre><code>import re
s = "[Term] id: GO:0000001 name: mitochondrion inheritance namespace: biological_process def: "The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton." [GOC:mcc, PMID:10873824, PMID:11389764] synonym: "mitochondrial inheritance" EXACT [] is_a: GO:0048308 ! organelle inheritance is_a: GO:0048311 ! mitochondrion distribution" #etc
the_data = re.findall("\[Term\](.*?)\n\s\[Term\]|\[Term\](.*?)\n\s\[Typedef\]", s)
</code></pre>
<p>最终输出:</p>
^{pr2}$