[Tutor] web scraping using Python and urlopen in Python 3.3

Dave Angel d at davea.name
Wed Nov 7 17:39:27 CET 2012


On 11/07/2012 11:25 AM, Walter Prins wrote:
> Seema,
>
> On 7 November 2012 15:44, Seema V Srivastava <seema.var at gmail.com> wrote:
>
>> Hi,
>> I am new to Python, trying to learn it by carrying out specific tasks.  I
>> want to start with trying to scrap the contents of a web page.  I have
>> downloaded Python 3.3 and BeautifulSoup 4.
>>
>> If I call upon urlopen in any form, such as below, I get the error as
>> shown below the syntax:  Does urlopen not apply to Python 3.3?  If not then
>> what;s the syntax I should be using?  Thanks so much.
>>
> See the documenation:
> http://docs.python.org/2/library/urllib.html#utility-functions
>
> Quote: "Also note that the
> urllib.urlopen()<http://docs.python.org/2/library/urllib.html#urllib.urlopen>function
> has been removed in Python 3 in favor of
> urllib2.urlopen()<http://docs.python.org/2/library/urllib2.html#urllib2.urlopen>
> ."
>
> Walter
>
>
Unfortunately, that's a bug in 2.7 documentation.  The actual Python3
approach does not use urllib2.

See http://docs.python.org/3.3/library/urllib.html


-- 

DaveA



More information about the Tutor mailing list