擅长:python、mysql、java
<p>要使用正则表达式提取所需的信息(忽略对正),请执行以下操作:</p>
<pre><code>import re
text = '''>4L type=chromosome; loc=6L:1.733034524; ID=4L; length=4534673;
release=r2.32; species=Homo;
CCAACATATTGTGCTAATGAGTGCCTCTCGTTCTCTGTCTTATATTACCG
CAAACCCAAAAAGACAATACACGACAGAGAGAGAGAGCAGCGGAGATATT
TAGATTGCCTATTAAATATGATCGCGTATGCGAGAGTAGTGCCAACATAT
TGTGCTCTCTATATAATGACTGCCTCTCATTCTGTCTTATTTTACCGCAA'''
# need . to match a new line.
result = re.search("\>(.*)", text, flags=re.DOTALL)
if result:
print(result.groups(1))
</code></pre>
<p>打印以下内容:</p>
^{pr2}$
<p>所以,也许你需要去掉新行,也许用这样丑陋的东西:</p>
<pre><code>result.groups(1)[0].replace("\n","")
</code></pre>