Python 3.5.1 urllib has no attribute request

后端 未结 6 1505
礼貌的吻别
礼貌的吻别 2020-12-17 08:19

I have tried

import urllib.request

or

import urllib

The path for my urllib is /Library/Framework

6条回答
  •  被撕碎了的回忆
    2020-12-17 08:47

    According to this, you have to use the following:

    import urllib.request
    

    The reason is:

    With packages, like this, you sometimes need to explicitly import the piece you want. That way, the urllib module doesn't have to load everything up just because you wanted one small part.

提交回复
热议问题