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

Alan Gauld alan.gauld at btinternet.com
Fri Oct 3 00:06:06 CEST 2014


On 02/10/14 16:41, Bo Morris wrote:

> of the following output
>
>         087-888-279   Pandora                    25.x.x.xxx       alias: not
> set
>
>         096-779-867   AM1LaptopBD-PC    25.x.x.xxx       alias: not set
>
>
>         097-552-220   OWS-Desktop 1        25.0.0.0          alias: not set
>
>         099-213-641   DESKTOP                 25.0.0.0          alias: not
> set
>
> I am trying to write a python script that will run the above command and
> only print out the IP's that begin with 25. How do I strip out all other
> text except for the IP's that begin with "25?"

Use split() to get the 'columns' in a list then use strip() to get rid 
of whitespace.


HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list