Next / Previous / Contents / Shipman's homepage

37. Scan.match(): Match a specific string

logscan.py
# - - -   S c a n . m a t c h

    def match(self, s):
        '''Does the rest of the line start with s?
        '''
        if (self.line[self.pos:]).startswith(s):
            return self.pos+len(s)
        else:
            return None