Fetch all links from a page using Python

Question:

Fetch all links from google home page

Program:

Explanation:

The urllib2 module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world — basic and digest authentication, redirections, cookies and more.

re module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched can be Unicode strings as well as 8-bit strings.

Output:

 

Leave a Reply