python:爬虫入门

简介: 直接上代码吧: 一、爬取某外卖平台的指定商家菜品信息 from urllib import request import json import random url = "https://www.

直接上代码吧:

一、爬取某外卖平台的指定商家菜品信息

from urllib import request
import json
import random

url = "https://www.ele.me/restapi/shopping/v2/menu?restaurant_id=1392240&terminal=web"

# 多搞几个user-agent 看上去更真实点~_^
user_agents = [
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36 QQBrowser/4.3.4986.400',
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:59.0) Gecko/20100101 Firefox/59.0']

random_user_agent = user_agents[random.randint(0, len(user_agents) - 1)]
page = request.Request(url, headers={'User-Agent': random_user_agent})
page_info = request.urlopen(page).read().decode("utf-8")

# 该url正好返回的是json数组,直接解析就可以了
menu_json = json.loads(page_info)


# 清理一些特殊字符串
def clean_menu_name(name):
    temp = ["-", "^_^", "\n", "◆"]
    for s in temp:
        name = name.replace(s, "")
    return name


for category in menu_json:
    print("分类名:", clean_menu_name(category["name"]))
    for food in category["foods"]:
        print("\t", "菜名:", clean_menu_name(food["name"]), " , 菜ID:", food["item_id"], " , 分类ID:", food["category_id"])
        for spec in food["specfoods"]:
            print("\t\t", "规格ID:", spec["sku_id"], " , 价格:", spec["price"])

 输出:

分类名: 必选品(【必选!】吃法二选一,嘛哩匠心出品)
	 菜名: 经典骨汤上等豚骨每日现熬  , 菜ID: 17548636051  , 分类ID: 13737658
		 规格ID: 20830000019  , 价格: 1
	 菜名: 特色干拌—麻辣拌(招牌,秘制麻酱)  , 菜ID: 17548637075  , 分类ID: 13737658
		 规格ID: 20830001043  , 价格: 1.5
分类名: 热销
	 菜名: 经典骨汤上等豚骨每日现熬  , 菜ID: 17548636051  , 分类ID: 13737658
		 规格ID: 20830000019  , 价格: 1
	 菜名: 娃娃菜  , 菜ID: 17548706707  , 分类ID: 13737835
		 规格ID: 20830070675  , 价格: 3
	 菜名: 精品肥牛  , 菜ID: 17548664723  , 分类ID: 13737800
		 规格ID: 20830028691  , 价格: 5.5
	 菜名: 金针菇  , 菜ID: 17548711827  , 分类ID: 13737835
		 规格ID: 20830075795  , 价格: 3
	 菜名: 土豆  , 菜ID: 17548693395  , 分类ID: 13737835
		 规格ID: 20830057363  , 价格: 2.5
	 菜名: 特色干拌—麻辣拌(招牌,秘制麻酱)  , 菜ID: 17548637075  , 分类ID: 13737658
		 规格ID: 20830001043  , 价格: 1.5
	 菜名: 精品蟹肉棒  , 菜ID: 17548654483  , 分类ID: 13737790
		 规格ID: 20830018451  , 价格: 4
	 菜名: 冬瓜  , 菜ID: 17548694419  , 分类ID: 13737835
		 规格ID: 20830058387  , 价格: 2.5
	 菜名: 梅林午餐肉  , 菜ID: 17548656531  , 分类ID: 13737790
		 规格ID: 20830020499  , 价格: 5.5
	 菜名: 【人气】秘制麻酱芝麻花生酱  , 菜ID: 17548638099  , 分类ID: 13737698
		 规格ID: 20830002067  , 价格: 1
分类名: 优惠
	 菜名: 招牌霸道~经典荤素~套餐  , 菜ID: 200000173605996435  , 分类ID: 1238754176
		 规格ID: 200000199013771155  , 价格: 29.4
	 菜名: 招牌霸道~素食主义~套餐  , 菜ID: 200000173616109459  , 分类ID: 1238754176
		 规格ID: 200000199009531795  , 价格: 25.2
分类名: Hi~嘛哩来袭咯~
	 菜名: 有问题?找嘛哩!~  , 菜ID: 200000173483983763  , 分类ID: 1238743250
		 规格ID: 200000198867809171  , 价格: 0.01
分类名: 【不得不吃】秘制酱料匠心出品
	 菜名: 【人气】秘制麻酱芝麻花生酱  , 菜ID: 17548638099  , 分类ID: 13737698
		 规格ID: 20830002067  , 价格: 1
	 菜名: 香辣酱  , 菜ID: 17548639123  , 分类ID: 13737698
		 规格ID: 20830003091  , 价格: 1
	 菜名: 沙茶酱  , 菜ID: 17548640147  , 分类ID: 13737698
		 规格ID: 20830004115  , 价格: 1
	 菜名: 菌菇酱  , 菜ID: 17548642195  , 分类ID: 13737698
		 规格ID: 20830006163  , 价格: 1
分类名: 【必选】麻辣在舌尖(口味选择)
	 菜名: 不麻+不辣  , 菜ID: 17548643219  , 分类ID: 13737734
		 规格ID: 20830007187  , 价格: 0
	 菜名: 微麻+微辣  , 菜ID: 17548644243  , 分类ID: 13737734
		 规格ID: 20830008211  , 价格: 0
	 菜名: 中麻+中辣  , 菜ID: 17548645267  , 分类ID: 13737734
		 规格ID: 20830009235  , 价格: 0
	 菜名: 重麻+重辣  , 菜ID: 17548646291  , 分类ID: 13737734
		 规格ID: 20830010259  , 价格: 0
分类名: 【可选】调味小料区(放碗里,不单独打包)
	 菜名: 香葱  , 菜ID: 17548647315  , 分类ID: 13737756
		 规格ID: 20830011283  , 价格: 0.1
	 菜名: 蒜泥  , 菜ID: 17548648339  , 分类ID: 13737756
		 规格ID: 20830012307  , 价格: 0.1
	 菜名: 醋  , 菜ID: 17548649363  , 分类ID: 13737756
		 规格ID: 20830013331  , 价格: 0.1
分类名: 人气特色榜单
	 菜名: 冻豆腐  , 菜ID: 17548650387  , 分类ID: 13737790
		 规格ID: 20830014355  , 价格: 3.5
	 菜名: 成都酥肉  , 菜ID: 17548651411  , 分类ID: 13737790
		 规格ID: 20830015379  , 价格: 4.5
	 菜名: 芝士年糕  , 菜ID: 17548653459  , 分类ID: 13737790
		 规格ID: 20830017427  , 价格: 4
	 菜名: 精品蟹肉棒  , 菜ID: 17548654483  , 分类ID: 13737790
		 规格ID: 20830018451  , 价格: 4
	 菜名: 荠菜丸子  , 菜ID: 17548655507  , 分类ID: 13737790
		 规格ID: 20830019475  , 价格: 3.5
	 菜名: 梅林午餐肉  , 菜ID: 17548656531  , 分类ID: 13737790
		 规格ID: 20830020499  , 价格: 5.5
	 菜名: 哈尔滨红肠  , 菜ID: 17548657555  , 分类ID: 13737790
		 规格ID: 20830021523  , 价格: 4
	 菜名: 甜玉米  , 菜ID: 17548658579  , 分类ID: 13737790
		 规格ID: 20830022547  , 价格: 3.5
	 菜名: 牛百叶  , 菜ID: 17548659603  , 分类ID: 13737790
		 规格ID: 20830023571  , 价格: 5
分类名: 精品荤菜
	 菜名: 燕饺  , 菜ID: 17548690323  , 分类ID: 13737800
		 规格ID: 20830054291  , 价格: 4
	 菜名: 广味香肠  , 菜ID: 17548691347  , 分类ID: 13737800
		 规格ID: 20830055315  , 价格: 4
	 菜名: 川味香肠  , 菜ID: 17548692371  , 分类ID: 13737800
		 规格ID: 20830056339  , 价格: 4
	 菜名: 培根  , 菜ID: 17548660627  , 分类ID: 13737800
		 规格ID: 20830024595  , 价格: 3.5
	 菜名: 鸡胗  , 菜ID: 17548661651  , 分类ID: 13737800
		 规格ID: 20830025619  , 价格: 4
	 菜名: 里脊肉  , 菜ID: 17548662675  , 分类ID: 13737800
		 规格ID: 20830026643  , 价格: 3.5
	 菜名: 骨肉相连  , 菜ID: 17548663699  , 分类ID: 13737800
		 规格ID: 20830027667  , 价格: 4
	 菜名: 精品肥牛  , 菜ID: 17548664723  , 分类ID: 13737800
		 规格ID: 20830028691  , 价格: 5.5
	 菜名: 鲜腐皮虾卷  , 菜ID: 200000176127363987  , 分类ID: 13737800
		 规格ID: 200000202129068947  , 价格: 4.9
	 菜名: 蟹粉包  , 菜ID: 17548668819  , 分类ID: 13737800
		 规格ID: 20830032787  , 价格: 3
	 菜名: 海胆包  , 菜ID: 17548669843  , 分类ID: 13737800
		 规格ID: 20830033811  , 价格: 3
	 菜名: 蛋饺  , 菜ID: 17548670867  , 分类ID: 13737800
		 规格ID: 20830034835  , 价格: 3.5
	 菜名: 千叶豆腐  , 菜ID: 17548671891  , 分类ID: 13737800
		 规格ID: 20830035859  , 价格: 3
	 菜名: 鱼皮豆腐  , 菜ID: 17548672915  , 分类ID: 13737800
		 规格ID: 20830036883  , 价格: 3
	 菜名: 深海鱼蛋丸  , 菜ID: 200000176114181011  , 分类ID: 13737800
		 规格ID: 200000202122663827  , 价格: 4
	 菜名: 墨鱼丸  , 菜ID: 17548674963  , 分类ID: 13737800
		 规格ID: 20830038931  , 价格: 4.5
	 菜名: 包心贡丸  , 菜ID: 17548675987  , 分类ID: 13737800
		 规格ID: 20830039955  , 价格: 4.5
	 菜名: 撒尿牛丸  , 菜ID: 17548677011  , 分类ID: 13737800
		 规格ID: 20830040979  , 价格: 4.5
	 菜名: 龙虾丸  , 菜ID: 17548678035  , 分类ID: 13737800
		 规格ID: 20830042003  , 价格: 4.5
	 菜名: 北极翅  , 菜ID: 17548680083  , 分类ID: 13737800
		 规格ID: 20830044051  , 价格: 4
	 菜名: 玉米肠  , 菜ID: 17548682131  , 分类ID: 13737800
		 规格ID: 20830046099  , 价格: 4
	 菜名: 开花肠  , 菜ID: 17548683155  , 分类ID: 13737800
		 规格ID: 20830047123  , 价格: 3.5
	 菜名: 亲亲肠  , 菜ID: 17548684179  , 分类ID: 13737800
		 规格ID: 20830048147  , 价格: 3.5
	 菜名: 大红肠  , 菜ID: 17548686227  , 分类ID: 13737800
		 规格ID: 20830050195  , 价格: 4
分类名: 蔬菜菌类
	 菜名: 土豆  , 菜ID: 17548693395  , 分类ID: 13737835
		 规格ID: 20830057363  , 价格: 2.5
	 菜名: 冬瓜  , 菜ID: 17548694419  , 分类ID: 13737835
		 规格ID: 20830058387  , 价格: 2.5
	 菜名: 藕片  , 菜ID: 17548695443  , 分类ID: 13737835
		 规格ID: 20830059411  , 价格: 3
	 菜名: 莴笋  , 菜ID: 17548696467  , 分类ID: 13737835
		 规格ID: 20830060435  , 价格: 3
	 菜名: 白萝卜  , 菜ID: 17548697491  , 分类ID: 13737835
		 规格ID: 20830061459  , 价格: 2
	 菜名: 生菜  , 菜ID: 17548699539  , 分类ID: 13737835
		 规格ID: 20830063507  , 价格: 2.5
	 菜名: 茼蒿菜  , 菜ID: 17548700563  , 分类ID: 13737835
		 规格ID: 20830064531  , 价格: 3
	 菜名: 香菜  , 菜ID: 17548701587  , 分类ID: 13737835
		 规格ID: 20830065555  , 价格: 3
	 菜名: 菠菜  , 菜ID: 17548702611  , 分类ID: 13737835
		 规格ID: 20830066579  , 价格: 3
	 菜名: 油麦菜  , 菜ID: 17548703635  , 分类ID: 13737835
		 规格ID: 20830067603  , 价格: 2.5
	 菜名: 小青菜  , 菜ID: 17548705683  , 分类ID: 13737835
		 规格ID: 20830069651  , 价格: 2.5
	 菜名: 娃娃菜  , 菜ID: 17548706707  , 分类ID: 13737835
		 规格ID: 20830070675  , 价格: 3
	 菜名: 有机花菜  , 菜ID: 17548707731  , 分类ID: 13737835
		 规格ID: 20830071699  , 价格: 3.5
	 菜名: 西兰花  , 菜ID: 17548708755  , 分类ID: 13737835
		 规格ID: 20830072723  , 价格: 3.5
	 菜名: 西红柿  , 菜ID: 17548709779  , 分类ID: 13737835
		 规格ID: 20830073747  , 价格: 3
	 菜名: 海带结  , 菜ID: 17548710803  , 分类ID: 13737835
		 规格ID: 20830074771  , 价格: 2.5
	 菜名: 金针菇  , 菜ID: 17548711827  , 分类ID: 13737835
		 规格ID: 20830075795  , 价格: 3
	 菜名: 香菇  , 菜ID: 17548712851  , 分类ID: 13737835
		 规格ID: 20830076819  , 价格: 3
	 菜名: 秀珍菇  , 菜ID: 17548713875  , 分类ID: 13737835
		 规格ID: 20830077843  , 价格: 3
	 菜名: 海鲜菇  , 菜ID: 17548714899  , 分类ID: 13737835
		 规格ID: 20830078867  , 价格: 3.5
	 菜名: 黑木耳  , 菜ID: 17548715923  , 分类ID: 13737835
		 规格ID: 20830079891  , 价格: 3
	 菜名: 红薯  , 菜ID: 17548717971  , 分类ID: 13737835
		 规格ID: 20830081939  , 价格: 2.5
	 菜名: 特级笋尖/水笋  , 菜ID: 17548718995  , 分类ID: 13737835
		 规格ID: 20830082963  , 价格: 4
分类名: 豆蛋类
	 菜名: 油豆腐  , 菜ID: 17548716947  , 分类ID: 13737840
		 规格ID: 20830080915  , 价格: 3
	 菜名: 日本豆腐  , 菜ID: 17548721043  , 分类ID: 13737840
		 规格ID: 20830085011  , 价格: 3
	 菜名: 绿豆芽  , 菜ID: 17548722067  , 分类ID: 13737840
		 规格ID: 20830086035  , 价格: 2
	 菜名: 豆腐皮  , 菜ID: 17548723091  , 分类ID: 13737840
		 规格ID: 20830087059  , 价格: 2.5
	 菜名: 厚百叶  , 菜ID: 17548724115  , 分类ID: 13737840
		 规格ID: 20830088083  , 价格: 3
	 菜名: 腐竹  , 菜ID: 17548725139  , 分类ID: 13737840
		 规格ID: 20830089107  , 价格: 3
	 菜名: 鸭血  , 菜ID: 17548726163  , 分类ID: 13737840
		 规格ID: 20830090131  , 价格: 3
	 菜名: 鹌鹑蛋  , 菜ID: 17548727187  , 分类ID: 13737840
		 规格ID: 20830091155  , 价格: 2.5
	 菜名: 油面筋  , 菜ID: 17548728211  , 分类ID: 13737840
		 规格ID: 20830092179  , 价格: 2.5
	 菜名: 油条  , 菜ID: 17548729235  , 分类ID: 13737840
		 规格ID: 20830093203  , 价格: 2.5
分类名: 主食类
	 菜名: 锅巴  , 菜ID: 17548730259  , 分类ID: 13737847
		 规格ID: 20830094227  , 价格: 2.5
	 菜名: 方便面  , 菜ID: 17548731283  , 分类ID: 13737847
		 规格ID: 20830095251  , 价格: 3
	 菜名: 鸡蛋面  , 菜ID: 17548732307  , 分类ID: 13737847
		 规格ID: 20830096275  , 价格: 2.5
	 菜名: 红薯宽粉  , 菜ID: 17548733331  , 分类ID: 13737847
		 规格ID: 20830097299  , 价格: 3
	 菜名: 红薯细粉  , 菜ID: 17548734355  , 分类ID: 13737847
		 规格ID: 20830098323  , 价格: 3
	 菜名: 蒙古宽粉  , 菜ID: 17548735379  , 分类ID: 13737847
		 规格ID: 20830099347  , 价格: 3
	 菜名: 手工细面  , 菜ID: 17548736403  , 分类ID: 13737847
		 规格ID: 20830100371  , 价格: 2.5
	 菜名: 刀削面  , 菜ID: 17548737427  , 分类ID: 13737847
		 规格ID: 20830101395  , 价格: 3
	 菜名: 玉米面条  , 菜ID: 17548738451  , 分类ID: 13737847
		 规格ID: 20830102419  , 价格: 4
	 菜名: 魔芋丝结  , 菜ID: 17548739475  , 分类ID: 13737847
		 规格ID: 20830103443  , 价格: 5
	 菜名: 龙口粉丝  , 菜ID: 17548740499  , 分类ID: 13737847
		 规格ID: 20830104467  , 价格: 4
	 菜名: 年糕节  , 菜ID: 17548741523  , 分类ID: 13737847
		 规格ID: 20830105491  , 价格: 2
分类名: 饿了么送红包
	 菜名: 扫码领红包  , 菜ID: 260439795603  , 分类ID: 526021154
		 规格ID: 301159743379  , 价格: 0.01
分类名: 霸道总裁套餐
	 菜名: 招牌霸道~经典荤素~套餐  , 菜ID: 200000173605996435  , 分类ID: 1238754176
		 规格ID: 200000199013771155  , 价格: 29.4
	 菜名: 招牌霸道~素食主义~套餐  , 菜ID: 200000173616109459  , 分类ID: 1238754176
		 规格ID: 200000199009531795  , 价格: 25.2

 

二、抓取博客园某园友的首页文章列表

以我自己的博客为例:

from urllib import request
import random
from bs4 import BeautifulSoup

url = "http://yjmyzz.cnblogs.com/"

# 多搞几个user-agent 看上去更真实点~_^
user_agents = [
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36 QQBrowser/4.3.4986.400',
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:59.0) Gecko/20100101 Firefox/59.0']

random_user_agent = user_agents[random.randint(0, len(user_agents) - 1)]
page = request.Request(url, headers={'User-Agent': random_user_agent})
html = request.urlopen(page).read().decode("utf-8")

bsObj = BeautifulSoup(html, "lxml")

# 找出标题的a链接
title_links = bsObj.find_all("a", {"class": "postTitle2"})

with open("blog.csv", "a", encoding='utf-8') as f:
    i = 0
    for link in title_links:
        i += 1
        print(str(i), "\t", link.string, "\t", link["href"])
        # 保存到csv文件中
        f.write(str(i) + "\t" + link.string + "\t" + link["href"] + "\n")

注:BeautifulSoup是一个专门的解析html/xml的模块,贼好用。

输出如下:

1 	 [置顶]关于博客的背景音乐 	 http://www.cnblogs.com/yjmyzz/p/listen-to-your-heart.html
2 	 python: 序列化/反序列化及对象的深拷贝/浅拷贝 	 http://www.cnblogs.com/yjmyzz/p/python-serialization-and-object-copy.html
3 	 python中的zip、lambda、map操作 	 http://www.cnblogs.com/yjmyzz/p/python-zip-lambda-map.html
4 	 python面向对象笔记 	 http://www.cnblogs.com/yjmyzz/p/python-object-oriented-programming.html
5 	 RxJava2学习笔记(3) 	 http://www.cnblogs.com/yjmyzz/p/rx-java-2-tutorial-3.html
6 	 RxJava2学习笔记(2) 	 http://www.cnblogs.com/yjmyzz/p/rx-java-2-tutorial-2.html
7 	 RxJava2学习笔记(1) 	 http://www.cnblogs.com/yjmyzz/p/rx-java-2-tutorial-1.html
8 	 Matplotlib新手上路(下) 	 http://www.cnblogs.com/yjmyzz/p/matplotlib-tutorial-3.html
9 	 Matplotlib新手上路(中) 	 http://www.cnblogs.com/yjmyzz/p/matplotlib-tutorial-2.html
10 	 Matplotlib新手上路(上) 	 http://www.cnblogs.com/yjmyzz/p/matplotlib-tutorial-1.html
11 	 pycharm如何设置python版本、设置国内pip镜像、添加第三方类库 	 http://www.cnblogs.com/yjmyzz/p/pycharm-add-third-package-and-add-domestic-mirror.html
12 	 利用java8对设计模式的重构 	 http://www.cnblogs.com/yjmyzz/p/refactor-design-pattern-using-java8.html
13 	 机器学习笔记(6):多类逻辑回归-使用gluon 	 http://www.cnblogs.com/yjmyzz/p/8128122.html
14 	 spring cloud:Edgware.RELEASE版本hystrix超时新坑 	 http://www.cnblogs.com/yjmyzz/p/8097713.html
15 	 spring cloud:Edgware.RELEASE版本中zuul回退方法的变化 	 http://www.cnblogs.com/yjmyzz/p/8093462.html
16 	 spring cloud:config-server中@RefreshScope的"陷阱" 	 http://www.cnblogs.com/yjmyzz/p/8085530.html
17 	 机器学习笔记(5):多类逻辑回归-手动添加隐藏层 	 http://www.cnblogs.com/yjmyzz/p/8035041.html
18 	 机器学习笔记(4):多类逻辑回归-使用gluton 	 http://www.cnblogs.com/yjmyzz/p/8034597.html
19 	 spring boot + embed tomcat + standalone jar的内存泄露问题 	 http://www.cnblogs.com/yjmyzz/p/the-memory-leak-problem-of-spring-boot-with-embed-tomcat.html
20 	 机器学习笔记(3):多类逻辑回归 	 http://www.cnblogs.com/yjmyzz/p/7789252.html
21 	 归一化(softmax)、信息熵、交叉熵 	 http://www.cnblogs.com/yjmyzz/p/7822990.html
22 	 NDArray自动求导 	 http://www.cnblogs.com/yjmyzz/p/7783286.html
23 	 机器学习笔记(2):线性回归-使用gluon 	 http://www.cnblogs.com/yjmyzz/p/7774166.html
24 	 机器学习笔记(1):线性回归 	 http://www.cnblogs.com/yjmyzz/p/7764496.html
25 	 mxnet安装及NDArray初体验 	 http://www.cnblogs.com/yjmyzz/p/mxnet-install-and-ndarray-demo.html
26 	 jupyter notebook 在mac OS上的安装 	 http://www.cnblogs.com/yjmyzz/p/how-to-install-jupyter-notebook-on-mac.html
27 	 spring cloud 学习(11) - 用fastson替换jackson及用gb2312码输出 	 http://www.cnblogs.com/yjmyzz/p/spring-cloud-set-response-gbk-encoding.html
28 	 spring cloud 学习(10) - 利用springfox集成swagger 	 http://www.cnblogs.com/yjmyzz/p/how-to-integrate-swagger-with-spring-cloud-by-springfox.html
29 	 spring-boot 速成(12) - 如何注入多个redis StringRedisTemplate 	 http://www.cnblogs.com/yjmyzz/p/how-to-inject-multi-redis-instance-in-spring-boot.html
30 	 spring cloud 学习(9) - turbine stream无法在eureka注册的解决办法 	 http://www.cnblogs.com/yjmyzz/p/spring-cloud-turbine-eureka-register-problem.html
31 	 java:线上问题排查常用手段 	 http://www.cnblogs.com/yjmyzz/p/7478266.html
32 	 java一些常用并发工具示例 	 http://www.cnblogs.com/yjmyzz/p/java-concurrent-tools-sample.html
33 	 kafka集群部署 	 http://www.cnblogs.com/yjmyzz/p/kafka-cluster-deployment.html
34 	 spring cloud 学习(8) - sleuth & zipkin 调用链跟踪 	 http://www.cnblogs.com/yjmyzz/p/spring-cloud-with-zipkin.html
35 	 spring集成kafka 	 http://www.cnblogs.com/yjmyzz/p/spring-integration-with-kafka.html
36 	 @Transactional导致AbstractRoutingDataSource动态数据源无法切换的解决办法 	 http://www.cnblogs.com/yjmyzz/p/7390331.html
37 	 centos上安装elasticsearch 5.5.1 遇到的各种坑 	 http://www.cnblogs.com/yjmyzz/p/7372561.html
38 	 spring cloud 学习(7) - 生产环境如何不停机热发布? 	 http://www.cnblogs.com/yjmyzz/p/how-to-hot-release-using-eureka-rest-operation.html
39 	 spring-boot 速成(11) - 单元测试 	 http://www.cnblogs.com/yjmyzz/p/unit-test-with-spring-boot.html
40 	 spring-boot 速成(10) -【个人邮箱/企业邮箱】发送邮件 	 http://www.cnblogs.com/yjmyzz/p/send-mail-using-spring-boot.html
41 	 spring cloud 学习(6) - zuul 微服务网关 	 http://www.cnblogs.com/yjmyzz/p/spring-cloud-zuul-demo.html

csv文件打开截图:
点击看原图

 

参考文档:

http://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/

作者: 菩提树下的杨过
出处: http://yjmyzz.cnblogs.com
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
目录
相关文章
|
7天前
|
数据采集 存储 API
网络爬虫与数据采集:使用Python自动化获取网页数据
【4月更文挑战第12天】本文介绍了Python网络爬虫的基础知识,包括网络爬虫概念(请求网页、解析、存储数据和处理异常)和Python常用的爬虫库requests(发送HTTP请求)与BeautifulSoup(解析HTML)。通过基本流程示例展示了如何导入库、发送请求、解析网页、提取数据、存储数据及处理异常。还提到了Python爬虫的实际应用,如获取新闻数据和商品信息。
|
11天前
|
数据采集 Python
【python】爬虫-西安医学院-校长信箱
本文以西安医学院-校长信箱为基础来展示爬虫案例。来介绍python爬虫。
【python】爬虫-西安医学院-校长信箱
|
17天前
|
数据采集 安全 Python
python并发编程:Python实现生产者消费者爬虫
python并发编程:Python实现生产者消费者爬虫
24 0
python并发编程:Python实现生产者消费者爬虫
|
23小时前
|
机器学习/深度学习 数据可视化 数据挖掘
《Python 简易速速上手小册》第9章:数据科学和机器学习入门(2024 最新版)
《Python 简易速速上手小册》第9章:数据科学和机器学习入门(2024 最新版)
5 1
|
23小时前
|
人工智能 数据挖掘 程序员
《Python 简易速速上手小册》第1章:Python 编程入门(2024 最新版)
《Python 简易速速上手小册》第1章:Python 编程入门(2024 最新版)
15 0
|
3天前
|
程序员 索引 Python
06-python数据容器-set(集合)入门基础操作
06-python数据容器-set(集合)入门基础操作
|
8天前
|
JavaScript 前端开发 API
游戏开发入门:Python后端与Vue前端的协同工作方式
【4月更文挑战第11天】使用Python后端(Flask或Django)和Vue.js前端开发游戏变得流行,能提高开发效率和可维护性。本文指导如何构建这样的项目,包括设置环境、创建虚拟环境、搭建后端API及前端Vue组件,强调前后端协作和API接口的重要性。这种架构促进团队合作,提升代码质量和游戏体验。
|
10天前
|
机器学习/深度学习 人工智能 算法
机器学习基础:使用Python和Scikit-learn入门
【4月更文挑战第9天】本文介绍了使用Python和Scikit-learn进行机器学习的基础知识和入门实践。首先,简述了机器学习的基本概念和类型。接着,展示了如何安装Python和Scikit-learn,加载与处理数据,选择模型进行训练,以及评估模型性能。通过本文,读者可了解机器学习入门步骤,并借助Python和Scikit-learn开始实践。
|
11天前
|
数据采集 存储 前端开发
Python爬虫如何快速入门
写了几篇网络爬虫的博文后,有网友留言问Python爬虫如何入门?今天就来了解一下什么是爬虫,如何快速的上手Python爬虫。
17 0
|
12天前
|
机器学习/深度学习 数据可视化 数据挖掘
利用Python进行数据分析与可视化:从入门到精通
本文将介绍如何使用Python语言进行数据分析与可视化,从基础概念到高级技巧一应俱全。通过学习本文,读者将掌握Python在数据处理、分析和可视化方面的核心技能,为实际项目应用打下坚实基础。