colab中下载文件

表白:黑白圣堂血天使,天剑鬼刀阿修罗。 
讲解对象:/colab中下载文件
作者:融水公子 rsgz
Colab教程

Colab教程 http://www.rsgz.top/post/410.html


1 方
法一wget工具
colab中下载文件和我们使用的linux服务器里面是一样的。可以使用wget进行下载

!wget -P /home/rsgz/MyDrive/重瞳者 https://www.google.com/imgres?imgurl=https%3A%2F%2Fimg.iplaysoft.com%2Fwp-content%2Fuploads%2F2019%2Ffree-images%2Ffree_stock_photo.jpg&imgrefurl=https%3A%2F%2Fwww.iplaysoft.com%2Ffree-images.html&tbnid=vQjlM9KtkGsb_M&vet=12ahUKEwiJ09SsjunuAhVPmp4KHYjTCrEQMygAegUIARCjAQ..i&docid=JeaDEV9l4RQZhM&w=680&h=453&q=%E5%9B%BE%E7%89%87&hl=zh-CN&ved=2ahUKEwiJ09SsjunuAhVPmp4KHYjTCrEQMygAegUIARCjAQ


方法2 也可以使用python的wget模块下载

先pip下载wget模块!pip install wget

查看wget帮助信息

import wgethelp(wget.download)========================Help on function download in module wget:download(url, out=None, bar=<function bar_adaptive at 0x7f06da51c158>)    High level function, which downloads URL into tmp file in current    directory and then renames it to filename autodetected from either URL    or HTTP headers.        :param bar: function to track download progress (visualize etc.)    :param out: output filename or directory    :return:    filename where URL is downloaded to

运行wget模块下载文件

import wgeturl = "https://www.python.org/static/img/python-logo@2x.png"wget.download(url, out='/home/rsgz/MyDrive/重瞳者/pythonLogo.png')

下载成功!
===

公众号:小雪妃

谢谢大家的支持!可以点击我的头像,进入我的空间浏览更多文章呢。建议大家360doc[www.360doc.com]注册一个账号登录,里面真的有很多优秀的文章,欢迎大家的到来。
---

(0)

相关推荐