摘要:
第一步 在文件夹目录下建立bat文件,填写以下内容: 最后双击bat文件。 第二步 运行后复制目录.txt文件内容到空白excel 使用hyperlink函数 最后生成效果 阅读全文
摘要:
# 与百度首页交互 from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditi... 阅读全文
摘要:
# 1.安装 pip install pymysql import pymysql try: # 1.链接 数据库 链接对象 connection() conn = pymysql.Connect( host="localhost", port=3306, db='animal', user='root', ... 阅读全文
摘要:
# pip install redis import redis # 1.链接数据库 key--value client = redis.StrictRedis(host='127.0.0.1', port=6379) # 2.设置key key = 'pyone' # 3.string 增加 result = client.set(key, "1") # 4.删 1, 0 resu... 阅读全文
摘要:
import requests from lxml import etree from bs4 import BeautifulSoup import json class BookSpider(object): def __init__(self): self.base_url = 'http://www.allitebooks.com/page/{}' ... 阅读全文
摘要:
import json import csv # 需求 json 中的数据 转换 成 csv文件 # 1.分别 读 , 创建文件 json_fp = open('02new.json', 'r') csv_fp = open('03csv.csv', 'w') # 2.提出 表头 , 表内容 data_list = json.load(json_fp) sheet_title = da... 阅读全文
摘要:
import json # 1.字符串和 dic list转换 # 字符串(json)----dict list data = '[{"name":"张三","age":20},{"name":"李四","age":18}]' list_data = json.loads(data) # dict list ---字符串 list2 = [{"name": "张三", "age": 20}... 阅读全文
摘要:
import requests from bs4 import BeautifulSoup from lxml import etree import json class BtcSpider(object): def __init__(self): self.url = 'http://8btc.com/forum-61-{}.html' self.h... 阅读全文
摘要:
# pip install beautifulsoup4 from bs4 import BeautifulSoup html_doc = """ The Dormouse's story p标签的内容 The Dormouse's story Once upon a time there were three little sisters; and their... 阅读全文
摘要:
# pip install beautifulsoup4 from bs4 import BeautifulSoup html_doc = """ The Dormouse's story The Dormouse's story Once upon a time there were three little sisters; and their names were Elsie,... 阅读全文
摘要:
# pip install beautifulsoup4 from bs4 import BeautifulSoup html_doc = """ The Dormouse's story The Dormouse's story Once upon a time there were three little sisters; and their names were Elsie, L... 阅读全文
摘要:
import requests from lxml import etree import json class BtcSpider(object): def __init__(self): self.base_url = 'http://8btc.com/forum-61-' self.headers = { "User-Ag... 阅读全文
摘要:
from lxml import etree html = """ 1 子 2 子 3 子 4 子 5 子 """ # 1.转类型 x_data ... 阅读全文
摘要:
import re import requests # 安装支持 解析html和XML的解析库 lxml # pip install lxml from lxml import etree url = 'http://news.baidu.com/' headers = { "User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 1... 阅读全文
摘要:
import re import requests url = 'http://news.baidu.com/' headers = { "User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Saf... 阅读全文
摘要:
import re # 1.拆分字符串 one = 'asdsfsgsh' # 标准 是 s 为拆分 pattern = re.compile('s') result = pattern.split(one) # print(result) # 2.匹配中文 two = '网页是最新版本的,适配移动端' # python中 匹配中问 [a-z] unicode的范围 * + ? pat... 阅读全文