# findsub1.py
# Written by Todd Wareham for CS 2500
"""
Given the name of a text file and a string as command-line arguments, deternmines
 if that string is a substring of any string in the file.

This version is implemented using a for-loop and string-slices.       
"""

import sys

f = open(sys.argv[1], "r")
s = sys.argv[2]
line = f.read()
f.close()

for i in range(0,len(line) - len(s),1):
    if (s == line[i:i + len(s)]):
        print "Substring found!"
	break
else:
    print "Substring not found"


