【问题标题】:wget: unable to resolve host address in google colabwget:无法解析谷歌 colab 中的主机地址
【发布时间】:2020-09-19 20:40:37
【问题描述】:

以下命令在 google colab 中有效。

!wget -P "/content/drive/My Drive/data" ftp://speedtest.tele2.net/1KB.zip

它下载数据。

但是,当我尝试下载多个文件时,

urls = ["ftp://speedtest.tele2.net/1KB.zip",
        "ftp://speedtest.tele2.net/512KB.zip"]

for url in urls:
  print (url)

  !wget -P "/content/drive/My Drive/data" url

出现以下错误:

wget: unable to resolve host address ‘url’ 

【问题讨论】:

    标签: python-3.x google-colaboratory wget


    【解决方案1】:

    您需要为变量添加前缀$

    urls = ["ftp://speedtest.tele2.net/1KB.zip",
            "ftp://speedtest.tele2.net/512KB.zip"]
    
    for url in urls:
      print (url)
    
      !wget -P "/content/drive/My Drive/data" $url
    

    【讨论】:

      猜你喜欢
      • 2021-01-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-04
      相关资源
      最近更新 更多