Python is not my best language, and so I\'m not all that good at finding the most efficient solutions to some of my problems. I have a very large string (coming from a 30 MB
If you just want to check if that substring exists,
for line in open("file"): if substring in line: print "exists" sys.exit() # or break to do some other stuff