Issue
I have made a clumsy first attempt at fuzzy pattern matching using the re
module in python 2.7.
Unfortunately every attempt I make returns an empty list. I simply don't understand the syntax required. I was wondering if someone might tell me why the following code:
import re
m = re.findall('(ATCT){e<=1}', 'ATCGATCGGCATGCAGTGCAGAAGTGACGAT')
print m
returns an empty list?
Solution
Since you intended to use the PyPi regex module, you need to use
>>> import regex
>>> m = regex.findall('(ATCT){e<=1}', 'ATCGATCGGCATGCAGTGCAGAAGTGACGAT')
>>> print(m)
['ATCG', 'ATCG']
Answered By - Wiktor Stribiżew
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.