On 25 October 2010 18:19, Richard D. Moores <rdmoo...@gmail.com> wrote:
> Doing it your way,
>
> from urllib import request
> a = 
> request.urlopen('http://www.marketwatch.com/investing/currency/CUR_USDYEN').read(20500)
> print(a[123:140])
>
> succeeds. Why?

Not sure how this exactly works but this is what I know. The
difference is that urllib is now a directory with files in it while
urllib2 was a single file. When you import <module> on a a single file
module normally all functions and classes are available to you.

Now that this is a directory some magic (or not?) has to happen in
__init__.py (read I also don't know). But I am sure someone here will
be able to explain this properly :-).

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

Reply via email to