[Tutor] IP address parse

Kent Johnson kent37 at tds.net
Sun Aug 10 23:58:55 CEST 2008

On Sun, Aug 10, 2008 at 1:58 AM, Josh Rosen <rosenville at gmail.com> wrote:
>> Since it doesn't look like you're doing anything with the parts of the ip
>> besides writing the whole ip to a file, you can eliminate the capturing
>> parentheses in your regular expression and replace them with a single pair:
>>        patt = re.compile(r"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})")

There is no need for the outer parentheses either.


More information about the Tutor mailing list