以下命令在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’
答案 0 :(得分: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