split(source[, maxsplit=0]) > list of strings Split string by the occurrences of the compiled pattern. If capturing parentheses are used in the pattern, then the text of all groups in the pattern are also returned as part of the resulting list. If maxsplit is nonzero, at most maxsplit splits occur, and the remainder of the string is returned as the final element of the list. Definition at line 418 of file aapre.py. 00418 : """split(source[, maxsplit=0]) > list of strings Split string by the occurrences of the compiled pattern. If capturing parentheses are used in the pattern, then the text of all groups in the pattern are also returned as part of the resulting list. If maxsplit is nonzero, at most maxsplit splits occur, and the remainder of the string is returned as the final element of the list. """ if maxsplit < 0: raise error, "negative split count" if maxsplit == 0: maxsplit = sys.maxint n = 0 pos = 0 lastmatch = 0 results = [] end = len(source) match = self.code.match append = results.append while n < maxsplit: regs = match(source, pos, end, 0) if not regs: break i, j = regs[0] if i == j: # Empty match if pos >= end: break pos = pos+1 continue append(source[lastmatch:i]) rest = regs[1:] if rest: for a, b in rest: if a == 1 or b == 1: group = None else: group = source[a:b] append(group) pos = lastmatch = j n = n + 1 append(source[lastmatch:]) return results def findall(self, source):
