Code: Select all
def restrict(html, starting_regexp, stopping_regexp)
start = html.index(starting_regexp)
stop = html.index(stopping_regexp, start)
html[start..stop]
end
Ok, what im gonna do is write everything i THINK i know about methods and then someone could please correct me?
methods=a function for an object, has the syntax of the codeword (in this case def) followed by the method name, and anything in brackets is the arguments.
in the above code start is a variable assigned the value of html, and the .index is another method on it and the value of html.index is equal to the value of the stuff in the brackets. Ditto for stop.
Ok i have other questions, but they will depend on how right/wrong I am currently with my "interpetation" so far. as i said, not 100%...so any confirmation greatly appreciated.