Script Request...

Diez B. Roggisch deets at nospam.web.de
Thu Mar 20 05:52:58 EDT 2008


some one wrote:

> Thanks Diez, I found some docs and examples on urllib2.  Now how do i
> search the string I get from urllib2, lets say I put it in "myURL", How
> do I search for only Numbers and ".'s" in the "#.#.#.#" pattern.  That
> is all I am interested in with all the data retrieved.  Just the IP
> Address from amongst a bunch of data that I have no use of currently.
> 
> I would I write a pattern matching function to extract only the IP
> address from "myURL"?

Pattern-matching can be done using regular expressions, they are available
in the module "re".

Diez



More information about the Python-list mailing list