Python3 with Urllib library to download images to local

Source: Internet
Author: User

Just download the picture from the Python3 statement Python2 not quite the same, the specific PYTHON3 statement is as follows:

Form Urllib Import Request

Jpg_link = ' ... ' #图片链接

Request.urlretrieve (Jpg_link, path) # path for path plus name Oh (like ~/workjpg/111.jpg)!!! If you do not need a path, you must also have a name, such as 111.jpg is stored directly in the current directory

You can also write this

Import Urllib.request

Jpg_link = ' ... ' #图片链接

Request.urlretrieve (Jpg_link, Path)

Python3 with Urllib library to download images to local

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.