原创 C語言調用另一個源文件裏的函數

fuTest.c #include<stdio.h> void FuTest1(){ printf("%s", "test1"); } void FuTest2(){ pri

原创 bs4學習

https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/ # coding: utf-8 from bs4 import BeautifulSoup html_doc = """ <h

原创 re學習(一)

# coding: utf-8 import re ''' re.match() re.search() 返回的都是一個對象,obj.group() re.findall() 返回的是一個列表 re.compil

原创 編譯找不到頭文件

報錯: omnisky@omnisky:~/xy/12/spdylay-master/python$ python setup.py build_ext running build_ext building 'spdylay' e

原创 爬蟲異常處理

# coding: utf-8 import urllib.request import urllib.error url = "https://www.cnblogs.com/" try: response = ur

原创 模擬各種請求方式(一)

各種接口 get請求: # coding: utf-8 import urllib.request import urllib.parse # https://www.baidu.com/s?ie=UTF-8&wd=%E6%9

原创 字符串匹配算法(KMP算法)

力扣 實現 strStr() 函數。 給定一個 haystack 字符串和一個 needle 字符串,在 haystack 字符串中找出 needle 字符串出現的第一個位置 (從0開始)。如果不存在,則返回 -1。 int s

原创 Handler處理器、自定義Opener

在請求裏面,還有兩個高級功能,一個是代理,一個是cookie,學習handler和opener使用的步驟: 見代碼 # coding: utf-8 import sys import io sys.stdout = io.Text

原创 模擬各種請求方式(二)

ajax-post: # coding: utf-8 import urllib.request import urllib.parse url = "http://www.kfc.com.cn/kfccda/ashx/GetS

原创 爬取百度貼吧

#coding: utf-8 import urllib.request import urllib.parse import time # http://tieba.baidu.com/f?kw=python&ie=utf-8

原创 代理--ip池的使用--阿布雲的使用

代理 import urllib.request proxy = { "http": "34.84.238.121" } url = "https://www.baidu.com/s?ie=UTF-8&wd=ip" h

原创 使用cookie模擬登陸

訪問登錄後的頁面 (1)抓包,抓取瀏覽器的cookie值,然後到代碼中應用 import urllib.request url = 'http://www.renren.com/960481378/profile' header