随笔分类 - python
python学习
摘要:url="https://www.liepin.com/campus/" import requests from bs4 import BeautifulSoup rr=requests.get(url) soup =BeautifulSoup(rr.text, "lxml") for itema
阅读全文
摘要:url="https://www.liepin.com/job/1932123793.shtml" import requests from bs4 import BeautifulSoup rr=requests.get(url) soup =BeautifulSoup(rr.text, "lxm
阅读全文
摘要:今天写爬虫,遇到一个坑,提示[scrapy.core.scraper] ERROR: Spider must return request, item, or None, got 'Tag' in <GET https://www. 其实原因很意外,我在代码中使用了item,同时scrapy又用it
阅读全文
摘要:def __init__(self, *args, **kwargs): super(MmzzSpider, self).__init__(*args, **kwargs) # 这里是关键 self.count=0 def parse_item(self, response): soup =Beau
阅读全文
摘要:from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selen
阅读全文
摘要:python3爬虫:爬虫进阶之ajax数据爬取发布时间: 2019-02-06 19:21:14动态网页数据抓取什么是AJAX:AJAX(Asynchronouse JavaScript And XML)异步JavaScript和XML。通过在后台与服务器进行少量数据交换,Ajax 可以使网页实现异
阅读全文
摘要:1.python -m pip install --upgrade pip(升级PIP) 2.pip install wheel 3.pip install lxml 4.pip install twisted 5.pip install pywin32 6.pip install srapy
阅读全文
摘要:self.SD.SetCapability(twain.CAP_DUPLEXENABLED, twain.TWTY_BOOL, 0) #单面扫描 self.SD.SetCapability(twain.CAP_DUPLEXENABLED, twain.TWTY_BOOL, 1)#双面扫描 self.
阅读全文
摘要:import sys from PIL import Image try: import src.abstract as pyinsane except ImportError: import pyinsane.abstract as pyinsane def set_scanner_opt(sca
阅读全文
摘要:def multiScan(self): """ Scan and return an array of PIL objects If no images, will return an empty array """ self.scanner.RequestAcquire(0, 1) images
阅读全文
摘要:import pyaudio import wave from PIL import ImageGrab import cv2 import threading import time from numpy import array from moviepy.editor import * impo
阅读全文
摘要:p = lambda x,y:x+y#匿名函数匿名函数lambda:是指一类无需定义标识符(函数名)的函数或子程序。 #lambda 函数可以接收任意多个参数 (包括可选参数) 并且返回单个表达式的值。 print(p(4,6))10 a=lambda x:x*x print(a(3))9 a =
阅读全文
摘要:import pypinyin # 不带声调的(style=pypinyin.NORMAL) def pinyin(word): s = '' for i in pypinyin.pinyin(word, style=pypinyin.NORMAL): s += ''.join(i) return
阅读全文
摘要:1.确认安装位置:D:\Anaconda3 2.进入: D:\Anaconda3\Scripts 3.pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pypinyin
阅读全文
摘要:#!/usr/bin/env python3 # -*- coding: utf-8 -*- '''对于单个字符的编码,Python提供了ord()函数获取字符的整数表示,chr()函数把编码转换为对应的字符: 并不局限于ascii编码 由于Python的字符串类型是str,在内存中以Unicode
阅读全文
摘要:#实时监控剪贴板内容的变化,并替换其中的回车,换行,逗号,再写入剪切板,以供使用。 import pyperclip import time last_string = pyperclip.paste() while True: # 检测频率 time.sleep(0.2) string = pyp
阅读全文
摘要:'''pandas 中 inplace 参数在很多函数中都会有,它的作用是:是否在原对象基础上进行修改 inplace = True:不创建新的对象,直接对原始对象进行修改; inplace = False:对数据进行修改,创建并返回新的对象承载其修改结果。 默认是False,即创建新的对象
阅读全文
摘要:import aircv as ac import matplotlib.pyplot as plt '''imshow()函数格式为: matplotlib.pyplot.imshow(X, cmap=None) X: 要绘制的图像或数组。 cmap: 颜色图谱(colormap), 默认绘制为R
阅读全文
摘要:arrarray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])arr1array([0, 1, 2, 3, 4])np.intersect1d(arr,arr1)#计算数组ARR ARR1的交集,并排序array([0, 1, 2, 3, 4])np.union1d(arr,arr
阅读全文