1、链接数据库
from pymysql import *
# 创建connection链接, 链接数据库
conn = connect(host='192.168.1.119', port=3306, database='yi_heng', user='root', password='Ecmoho@2018', charset='utf8')
# 获取cursor游标对象
cursor = conn.cursor()
count = cursor.execute("select * from BOOHEE_Foods_data")
# print(count)
result = cursor.fetchall()
# print(result)
url_list = []
for row in result:
print(url_list)
2、运用python的协程gevent进行下载
import client_mysql
import gevent
import urllib.request
from gevent import monkey
import time
# 有耗时操作时使用
monkey.patch_all()
def download(image_name, url):
def main():
if __name__ == '__main__':