Try
global bookStartLine
global bookEndLine
def grabLine(currentUrl):
### blah blah defines what lines is
currentBookStartLine,currentBookEndLine = False,False #needed to define these before use below
for index,line in enumerate(lines,start=1): #start = 1 so index gets 1 on first iteration
if "*** START OF THE PROJECT" in line:
currentBookStartLine = index
if "*** END OF THE PROJECT" in line:
currentBookEndLine = index
bookStartLine = currentBookStartLine
bookEndLine = currentBookEndLine
grabLine('http://www.gutenberg.org/cache/epub/768/pg768.txt') #grabLine not grabline
print(bookStartLine)
print(bookEndLine)
4
solved What wrong with this code? [closed]