Skip to content

Instantly share code, notes, and snippets.

@kjoconnor
Created October 16, 2012 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjoconnor/3897144 to your computer and use it in GitHub Desktop.
Save kjoconnor/3897144 to your computer and use it in GitHub Desktop.
Rosalind Subs
# 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