上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 198 下一页
摘要: 概述 csv是最通用的文件格式,本质是文本文件,用记事本即可打开。同一行中每个字段间用逗号分隔,在csv中显示的是在不同单元格中,在记事本中显示的是一行中用逗号分隔。 xls是excel专用格式,是二进制文件,只有excel才能打开。 CSV操作 csv写入 1.写入列表(list)数据 使用 cs 阅读全文
posted @ 2020-03-19 10:22 brady-wang 阅读(793) 评论(0) 推荐(0)
摘要: # -*- coding: utf-8 -*- import scrapy class TestSpider(scrapy.Spider): name = 'test' allowed_domains = ['yeves.cn'] start_urls = ['https://yeves.cn/'] 阅读全文
posted @ 2020-03-19 10:15 brady-wang 阅读(718) 评论(0) 推荐(0)
摘要: 使用的是python3.7的环境,解析数据要用xpath,系统是mac pip install lxml一分钟后。。。下载成功 开始写代码, from lxml import etree挂了…,lxml中竟然没有etree模块 换个方法 from lxml import htmlet = html. 阅读全文
posted @ 2020-03-17 17:22 brady-wang 阅读(2968) 评论(0) 推荐(0)
摘要: # -*- coding: utf-8 -*- import re from time import sleep import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import Craw 阅读全文
posted @ 2020-03-17 13:12 brady-wang 阅读(443) 评论(0) 推荐(0)
摘要: 去除数字,特殊字符,只保留汉字 ? 1 2 3 4 5 6 7 8 import re s = '1123*#$ 中abc国' str = re.sub('[a-zA-Z0-9'!"#$%&\'()*+,-./:;<=>?@,。?★、…【】《》?“”‘'![\\]^_`{|}~\s]+', "", 阅读全文
posted @ 2020-03-17 11:48 brady-wang 阅读(22094) 评论(0) 推荐(0)
摘要: # -*- coding: utf-8 -*- import csv import scrapy class GjSpider(scrapy.Spider): name = 'gj' allowed_domains = ['ganji.com'] start_urls = ['http://sz.g 阅读全文
posted @ 2020-03-16 17:39 brady-wang 阅读(364) 评论(0) 推荐(0)
摘要: # -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrap 阅读全文
posted @ 2020-03-16 16:43 brady-wang 阅读(1347) 评论(0) 推荐(0)
摘要: Python中xlrd和xlwt模块使用方法 阅读目录 安装 xlrd模块使用 xlwt模块 xlrd模块实现对excel文件内容读取,xlwt模块实现对excel文件的写入。 回到顶部 安装 ? 1 2 pip install xlrd pip install xlwt 回到顶部 xlrd模块使用 阅读全文
posted @ 2020-03-16 16:05 brady-wang 阅读(890) 评论(0) 推荐(0)
摘要: 1 setting里面启动管道 ITEM_PIPELINES = { 'ganji.pipelines.GanjiPipeline': 300,}2 拿到的数据通过yield返回给管道 # -*- coding: utf-8 -*- import csv import scrapy class Gj 阅读全文
posted @ 2020-03-16 15:53 brady-wang 阅读(577) 评论(0) 推荐(0)
摘要: import matplotlib.pyplot as plt import matplotlib as mpl baseclass=[1,2,3,4] name = ['class1','class2','class3','class4'] scores = [67,79,89,50] plt.t 阅读全文
posted @ 2020-03-15 20:42 brady-wang 阅读(8894) 评论(0) 推荐(0)
上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 198 下一页