2

I tried to use the keyword argument fromlist to emulate 'from urllib import urlopen'.What's the correct way to do this? Hope for your help.

    mymodule = __import__('urllib',fromlist=['urlopen'])
    >>> urlopen('http://www.google.com')
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    NameError: name 'urlopen' is not defined
programforjoy
  • 391
  • 3
  • 12

0 Answers0