NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Python Majic

January 22, 2010
by Farmerjoecoledge
Farmerjoecoledge's Avatar

Another twister for your Friday morning.TooMuchPi

January 22, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Farmerjoe,

Although a lot of great learning can come from figuring out these issues, this is a tricky enough problem that I'm gonna step in here. Python is still an evolving language, and because of that there are sometimes weird things that can come up between different versions. urllib.request was added as part of Python 3, and you are using python 2.6 which is still the most common version of Python out there. For Python 2.6 you need to use urllib.urlopen() to read data from urls. You can check out the documentation for urllib on python 2.6.

Hope that gets you going.

Humberto

January 22, 2010
by Farmerjoecoledge
Farmerjoecoledge's Avatar

import urllib page = urllib.urlopen('http://www.google.com').read() print page

Hi Humberto,

I had a hell of a time finding this little piece of code. I lost the original one. But there it is and I've got my feeds back so all's good.

Grant

Post a Reply

Please log in to post a reply.

Did you know that one NerdKits customer controlled a laser pointer with his computer using a microcontroller? Learn more...