Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,如果我有一个字符串 'ATGAGGGATAGAGGGTTGGGAGAGATGGATAGGGGATAGATTG' 我必须在 ATG 和 TTG 之间获取子字符串,因为我们可以看到字符串中有两种。
无论如何我都无法弄清楚,请帮助我完成它!
使用正则表达式可以轻松实现。
例如:
import re a = 'ATGAGGGATAGAGGGTTGGGAGAGATGGATAGGGGATAGATTG' print re.findall("ATG(.*?)TTG", a)
输出:
['AGGGATAGAGGG', 'GATAGGGGATAGA']