AttributeError: 'module' object has no attribute 'urlretrieve'

后端 未结 3 1065
长发绾君心
长发绾君心 2020-12-07 12:17

I am trying to write a program that will download mp3\'s off of a website then join them together but whenever I try to download the files I get this error:

         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 13:01

    Suppose you have following lines of code

    MyUrl = "www.google.com" #Your url goes here
    urllib.urlretrieve(MyUrl)
    

    If you are receiving following error message

    AttributeError: module 'urllib' has no attribute 'urlretrieve'
    

    Then you should try following code to fix the issue:

    import urllib.request
    MyUrl = "www.google.com" #Your url goes here
    urllib.request.urlretrieve(MyUrl)
    

提交回复
热议问题