]> granicus.if.org Git - python/commitdiff
parse150(): Simplify RE used to parse the message a little, taking advantage
authorFred Drake <fdrake@acm.org>
Mon, 27 Apr 1998 14:39:44 +0000 (14:39 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 27 Apr 1998 14:39:44 +0000 (14:39 +0000)
of using re instead of regex.

Lib/ftplib.py

index 63903d0879441b64205b49a349ffeac896290b39..0c14c6b31ad05a064f6718fa0b6e82775ca87cac 100644 (file)
@@ -486,8 +486,7 @@ def parse150(resp):
        global _150_re
        if _150_re is None:
                import re
-               _150_re = re.compile("150 .* \(([0-9][0-9]*) bytes\)",
-                                    re.IGNORECASE)
+               _150_re = re.compile("150 .* \((\d+) bytes\)", re.IGNORECASE)
        m = _150_re.match(resp)
        if m:
                return string.atoi(m.group(1))