[Tutor] printing all text that begins with "25"

Sebastian Silva sebastian at fuentelibre.org
Thu Oct 2 18:50:59 CEST 2014



El jue, 2 de oct 2014 a las 11:33 AM, David Rock <david at graniteweb.com> 
escribió:
> 
> A regex may be possible, but you will have similar issues to using
> split.

In my humble experience, a regex is the way to go:

import re
ip = re.findall( r'[0-9]+(?:\.[0-9]+){3}', s )

you will get a list of IP addresses and can filter from there which 
ones start with "25."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141002/0679f524/attachment.html>


More information about the Tutor mailing list