(slightly OT): Python and linux - very cool

Usenet beaconadsl at adsl-1.uk.clara.net
Fri Aug 9 17:03:26 CEST 2002


>
> import re
>
> iplist = []
>
> for line in open("/var/log/httpd/access_log"):
>    m = re.match(r"^(\d+\.\d+\.\d+\.\d+)", line)
>    if m:
>       ip = m.group(1)
>       if ip != "127.0.0.1":
>          iplist.append(ip)
>
>
> I don't thinkthat's significantly worse (or better...) than the Perl
> version?
>

To me it's definitely more readable.





More information about the Python-list mailing list