上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 67 下一页
摘要: # 抓取今日头条的新闻链接 from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait option = webdriver.ChromeOptions() # option.add_argument('headless') driver = webdriver.Chrom... 阅读全文
posted @ 2019-03-31 22:22 hank-li 阅读(82) 评论(0) 推荐(0)
摘要: 第一步 在文件夹目录下建立bat文件,填写以下内容: 最后双击bat文件。 第二步 运行后复制目录.txt文件内容到空白excel 使用hyperlink函数 最后生成效果 阅读全文
posted @ 2019-03-30 21:03 hank-li 阅读(301) 评论(0) 推荐(0)
摘要: # 与百度首页交互 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... 阅读全文
posted @ 2019-03-30 14:00 hank-li 阅读(137) 评论(0) 推荐(0)
摘要: # 1.安装 pip install pymysql import pymysql try: # 1.链接 数据库 链接对象 connection() conn = pymysql.Connect( host="localhost", port=3306, db='animal', user='root', ... 阅读全文
posted @ 2019-03-30 13:30 hank-li 阅读(93) 评论(0) 推荐(0)
摘要: # 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... 阅读全文
posted @ 2019-03-30 13:21 hank-li 阅读(70) 评论(0) 推荐(0)
摘要: 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/{}' ... 阅读全文
posted @ 2019-03-30 12:34 hank-li 阅读(126) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2019-03-30 12:32 hank-li 阅读(104) 评论(0) 推荐(0)
摘要: 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}... 阅读全文
posted @ 2019-03-30 12:23 hank-li 阅读(110) 评论(0) 推荐(0)
摘要: 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... 阅读全文
posted @ 2019-03-30 12:02 hank-li 阅读(128) 评论(0) 推荐(0)
摘要: # 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... 阅读全文
posted @ 2019-03-30 12:00 hank-li 阅读(125) 评论(0) 推荐(0)
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 67 下一页