On Tue, Jul 9, 2013 at 10:00 PM, Paul Smith <paulrsmith7...@gmail.com>wrote:

> Tutor-
>
> Ok newbie to coding here attempting to build controlled web scraper and
> have followed several books-tutorials and am failing at step one.
>
> This is the 3.3.1 code I am trying to run..
> ===
> import urllib.request
>
> htmltext = urllib.request.urlopen("http://google.com";).read
>
> print htmltext
> ===
> Other version...
> ===
> #try py url open 7
>
> import urllib.request
> res = urllib.request.urlopen('http://python.org/')
> html = res.read()
> print = html
> close res
> input = ("Press enter to exit")
> ===
>
> so when I run what I think is proper 3.3.1 python code it hangs up with
> syntax error with the idle shell red highlighting the last print reference
> i.e. "htmltext"  or "html".
>
> What is this humble newbie not getting?
>
>
>
I'm fairly certain that what you're missing is that in python 3.x, print is
no longer a statement but a function. The correct line would be
"print(htmltext)".

HTH,
Hugo
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to