Why does this fail?

Isaac To kkto at csis.hku.hk
Mon Jan 5 03:14:10 CET 2004


>>>>> "Dave" == Dave Murray <dlmurray at micro-net.com> writes:

    Dave> New to Python question, why does this fail?  Thanks, Dave

    Dave> f = urllib.open(URL)

urllib does not have an open function.  Instead, it has a constructor called
URLopener, which creates an object with such a method.  So instead, you have
to say

  opener = urllib.URLopener()
  f = opener(URL)

Regards,
Isaac.



More information about the Python-list mailing list