上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 26 下一页
摘要: 1. 淘宝商品信息定向爬虫 链接: https://www.taobao.com/ 2. 实例编写 2.1 整体框架 # -*- coding: utf-8 -*- import requests import re def getHTMLText(url): print("") # 对获得的每个页 阅读全文
posted @ 2020-01-31 15:53 douzujun 阅读(3241) 评论(4) 推荐(0) 编辑
摘要: 1. 代码 # -*- coding: utf-8 -*- """ Created on Thu Jan 30 01:27:38 2020 @author: douzi """ import requests from bs4 import BeautifulSoup import bs4 def 阅读全文
posted @ 2020-01-30 18:35 douzujun 阅读(519) 评论(2) 推荐(0) 编辑
摘要: 1. format (1)设置对齐方式 (< (默认)左对齐、> 右对齐、^ 中间对齐、= (只用于数字)在小数点后进行补齐) print("{:<6} is {}".format('123', 'abcd')) # 左对齐 print("{:>6} is {}".format('123', 'ab 阅读全文
posted @ 2020-01-30 02:18 douzujun 阅读(577) 评论(0) 推荐(0) 编辑
摘要: 1. 中国大学排名定向爬虫 网站:http://www.zuihaodaxue.com/zuihaodaxuepaiming2016.html 查看源代码,发现信息直接写在HTML里的,即该定向爬虫可以实现 2. 程序的结构设计 2. 实例编写 2.1 代码总框架 # -*- coding: utf 阅读全文
posted @ 2020-01-30 01:27 douzujun 阅读(781) 评论(0) 推荐(0) 编辑
摘要: 1. 正则表达式 https://www.cnblogs.com/douzujun/p/7446448.html 单词边界的用法(非常好用啊!!!) 比如,我只想替换 app 为 qq,不像替换掉 apple和application里的app re.findall(r'\b\d{3}\b', '11 阅读全文
posted @ 2020-01-29 23:07 douzujun 阅读(1066) 评论(0) 推荐(0) 编辑
摘要: 1. 基于bs4库的HTML内容查找方法 1.1 <>.find_all() 和 re (正则表达式库) (1)参数为单一字符串 (2)参数为 列表 (3)参数为True,则返回所有标签内容 (4)显示 以 b 开头的标签,如 b,body。(使用 re:正则表达式库) import request 阅读全文
posted @ 2020-01-29 20:19 douzujun 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 1. 信息提取的一般方法 1.1 方法一 1.2 方法2 1.3 方法3 2. 实例 import requests from bs4 import BeautifulSoup r = requests.get("http://python123.io/ws/demo.html") demo = r 阅读全文
posted @ 2020-01-29 19:48 douzujun 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 官网下载好anaconda,然后 bash Anaconda3-5.2.0-Linux-x86_64.sh 安装时候,需要输入的地方输入yes,然后一路回车: 安装完成,打开 .bashrc文件,添加把 export xxxx 写到最后一行,保存 sudo gedit ~/.bashrc expor 阅读全文
posted @ 2020-01-29 00:07 douzujun 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 1. 信息标记 2. 信息标记种类 2.1 XML 举例: 2.2 JSON 2.3 YAML 3. 三种信息标记形式比较 阅读全文
posted @ 2020-01-23 22:45 douzujun 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 1. prettify() import requests from bs4 import BeautifulSoup r = requests.get("http://python123.io/ws/demo.html") demo = r.text print(demo, "\n") soup 阅读全文
posted @ 2020-01-23 20:36 douzujun 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 1. 基于bs4库的HTML内容遍历方法 1.1 .contents 举例 1.2 结点的父亲标签 1.3 标签树的上行遍历(parents) 1.4 标签树的平行遍历 注意:标签的儿子结点可能是 NavigableString 阅读全文
posted @ 2020-01-22 18:06 douzujun 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 1. Beautiful Soup安装 pip install beautifulsoup linux要用 pip3 2. 使用 使用这个网站:https://python123.io/ws/demo.html # -*- coding: utf-8 -*- """ Created on Tue J 阅读全文
posted @ 2020-01-21 22:06 douzujun 阅读(183) 评论(0) 推荐(0) 编辑
摘要: http://m.ip138.com/ import requests url = "http://m.ip138.com/ip.asp?ip=" r = requests.get(url + "202.204.80.112") print(r.status_code) print(r.text[- 阅读全文
posted @ 2020-01-20 01:03 douzujun 阅读(646) 评论(0) 推荐(0) 编辑
摘要: 1. 网络图片爬取 import os import requests root = ".//" url = "https://img2018.cnblogs.com/i-beta/817161/202001/817161-20200116224428592-123074215.png" path 阅读全文
posted @ 2020-01-20 00:56 douzujun 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 1. cookie和session区别 2. 爬虫处理cookie和session 3. 处理cookies和session请求 4. 尝试使用session登录人人网(别试,了解一下) # -*- coding: utf-8 -*- import requests session = reques 阅读全文
posted @ 2020-01-19 23:12 douzujun 阅读(734) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-01-19 02:43 douzujun 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 1. requests模块发送post请求 # -*- coding: utf-8 -*- """ Created on Sun Jan 19 01:26:05 2020 @author: douzi """ # -*- coding: utf-8 -*- import requests impor 阅读全文
posted @ 2020-01-19 01:54 douzujun 阅读(699) 评论(0) 推荐(0) 编辑
摘要: 1. requests库安装 推荐使用anaconda,自带 2. requests使用 import requests r = requests.get("http://www.baidu.com") print(r.status_code) r.encoding = 'utf-8' print( 阅读全文
posted @ 2020-01-16 22:46 douzujun 阅读(573) 评论(0) 推荐(0) 编辑
摘要: 1. 字符串知识点 2. HTTP和HTTPS 3. url的形式 4. HTTP请求格式 5. GET和POST两种基本请求方法的区别 (1)GET把参数包含在URL中,POST通过request body传递参数。 (2)GET请求在URL中传送的参数是有长度限制的,而POST没有(大文本)。 阅读全文
posted @ 2020-01-16 18:05 douzujun 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 6ZUMD7WWWU-eyJsaWNlbnNlSWQiOiI2WlVNRDdXV1dVIiwibGljZW5zZWVOYW1lIjoiSmV0cyBHcm91cCIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJ 阅读全文
posted @ 2020-01-16 16:25 douzujun 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 1. Git简介 2. 版本创建 2.1 安装 sudo apt-get install git 2.2 创建一个版本库 (1)创建一个目录git_test,在git_test目录下创建一个版本库,命令: git init (2)在git_test目录下创建一个文件code.txt,编辑内容如下: 阅读全文
posted @ 2020-01-13 15:09 douzujun 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 使用 阅读全文
posted @ 2020-01-06 23:09 douzujun 阅读(751) 评论(0) 推荐(0) 编辑
摘要: 考研二战结束,明天开始写代码学习新知识,健身,奥利给! 阅读全文
posted @ 2019-12-22 18:43 douzujun 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. N 阅读全文
posted @ 2019-06-05 16:37 douzujun 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the dep 阅读全文
posted @ 2019-06-05 16:28 douzujun 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest le 阅读全文
posted @ 2019-06-05 16:25 douzujun 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2019-06-05 16:24 douzujun 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2019-06-05 16:01 douzujun 阅读(326) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: 阅读全文
posted @ 2019-06-05 15:20 douzujun 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 100. Same Tree 100. Same Tree Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same 阅读全文
posted @ 2019-05-26 22:14 douzujun 阅读(249) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 26 下一页