Created
October 16, 2012 03:48
-
-
Save kjoconnor/3897144 to your computer and use it in GitHub Desktop.
Rosalind Subs
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
# For http://rosalind.info/problems/subs/ | |
import re | |
import sys | |
string = None | |
substring = None | |
for line in open('rosalind_subs.txt', 'r'): | |
if string is None: | |
string = line.rstrip() | |
else: | |
substring = line.rstrip() | |
for pos in re.finditer(substring, string): | |
sys.stdout.write(str(pos.start() + 1) + ' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment