Last active
April 8, 2019 08:14
-
-
Save StephenFordham/ddcfef60921c133999699ee4bf1213d3 to your computer and use it in GitHub Desktop.
RegexExample3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
DNA = 'GAGCGCTAGCCAAA' | |
match = re.search('AAA', DNA) | |
print(match.start()) | |
#11 | |
print(match.end()) | |
#14 | |
print(match.span()) | |
# (11,14) | |
print(match.group()) | |
# AAA | |
# if we call the group method on the result of a regex search | |
# we get the portion of the string that matched the input string | |
# that matched the pattern |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment