原创 python crawler - 使用代理增加博客文章訪問量

import re , random , requests , logging from lxml import etree from multiprocessing.dummy import Pool as ThreadPool

原创 python crawler - Session模擬表單登陸並下載登錄後用戶頭像demo

要登錄的網站:https://www.1point3acres.com/bbs/ 找到form中的action查看提交表單的目的地址: https://www.1point3acres.com/bbs/member.php?mod

原创 python - matplotlib demo

平面圖繪製 from matplotlib import pyplot as plt import numpy as np # linspace(x, y)產生一個有100個元素的行向量,其中的元素在區間[x, y]中等間隔分佈。

原创 Pandas - Series、DataFrame、plot(demo

import pandas import numpy as np from pandas import Series , DataFrame s = Series([1,2,3,np.nan,5,1]) print(s) 0

原创 python-對docx文檔操作demo + word批量轉pdf 及[AttributeError]解決方案

pip install python-docx 1.讀取sample.docx: import docx from docx import Document from pprint import pprint def getT

原创 在python中使用mysql數據庫demo

mysql數據庫 版本:mysql Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL) 0.免密登陸 mysql -u root -p 不輸密碼直接回車 1.

原创 python crawler -利用XPath獲取B站推薦視頻封面

推薦頁封面抓取不需要考慮JS,直接用XPath定位<img>即可。 推薦頁url:https://www.bilibili.com/list/recommend/1.html 翻到x頁就是x.html 抓取封面,定位到<img>

原创 python-PyPDF2對pdf的複製 && 合併demo

pip install PyPDF2 1.copy && merge操作 from PyPDF2 import PdfFileReader , PdfFileWriter from PyPDF2 import PdfFileM

原创 python crawler - 分析AJAX(根據json)直接爬取攜程酒店問答存入本地

url:https://hotels.ctrip.com/Domestic/tool/AjaxHotelFaqLoad.aspx 參數: hotelid :酒店id page : 頁數 # coding=utf-8 impor

原创 使用selenium模擬瀏覽器進行數據抓取+搜索指定關鍵詞+下拉滾動demo+selenium等待機制(Chrome Browser

0.安裝selenium + Chrome Driver 安裝selenium: pip install selenium 安裝Chrome Driver: 下載:http://chromedriver.storage.goog

原创 遇到的各類報錯彙總查用

錯誤: from keras.layers import merge # 然後調用merge(),報錯 TypeError: 'module' object is not callable(不可調用) 原因: Keras在2.1

原创 Codeforces Round #523 (Div. 2) A模擬 B 貪心 排序 C dp D貪心排序

A Code: #include <bits/stdc++.h> using namespace std ; int main(){ int n , S ; cin >> n >> S ; int res = S / n

原创 牛客-PAT歷年真題刷題記錄(更畢)

本地:F:\nowcoder\pat> ctrl+f 搜索題目達到指定位置 Public Bike Management (30) 題目鏈接 題意:0處是管理處,sp處是向管理處報告問題的車站,現要從0處到達sp處,途中路過車站

原创 OpenCV3計算機視覺:Python實現 讀書筆記-第四章

第四章 使用分水嶺和GrabCut算法物體分割 GrabCut算法步驟 在圖片中定義含有(若干個)物體的矩形 矩形外的區域被認爲是背景 對於用戶定義的矩形區域,用背景中的數據區別裏面的前景和背景 用高斯混合模型對背景和前景建模

原创 OpenCV3計算機視覺:Python實現 讀書筆記-第五章

第五章 人臉檢測和識別 Haar級聯 Haar級聯具有尺度不變性(不同尺度的兩幅圖像也有相似特徵) OpenCV的Haar級聯不具有旋轉不變形 類Harr特徵是一種用於實現實時人臉跟蹤的特徵,每個類Haar特徵都描述了相鄰圖像區