最近学习 python 走火入魔,趁着热情继续初级体验一下下爬虫,以前用 java也写过,这里还是最初级的爬取html,都没有用html解析器,正则等...而且一直在循环效率肯定### 很低下 import urllib.request as urllib2 import random ua_list = [ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv2.0.1) Gecko/20100101 Firefox/4.0.1", &qu…
import requests import re import pymysql #10页 仔细观察路由 db = pymysql.connect("localhost","root","root","testdb" ) cursor = db.cursor() for i in range(1,10): url = 'http://*******8****' url=url+'index_'+str(i)+'.html' r…