
python
llrraa2010
这个作者很懒,什么都没留下…
展开
-
python从多个目录的网页中获取json数据并提取处理
【代码】python从多个目录的网页中获取json数据并提取处理。原创 2024-06-15 19:34:16 · 198 阅读 · 0 评论 -
python 鼠标选择区域截图、识别文字、模糊搜索答案
【代码】python 鼠标选择区域截图、识别文字、模糊搜索答案。原创 2024-06-02 10:31:03 · 677 阅读 · 2 评论 -
Python 剔除端口并生成安全策略端口列表
【代码】Python 剔除端口并生成安全策略端口列表。原创 2024-06-02 09:43:02 · 162 阅读 · 0 评论 -
Python查找中国城市、省份
def getpca(ca): for i in pcadict: if i.find(ca)>=0: print(i) return(i)def catop(ca): return getpca( getpca(ca)[0:2]+'0000').strip().split('\t')[1] pcadict =[' 110000 北京市 ','110101 东城区 ',.原创 2022-04-01 19:06:46 · 5246 阅读 · 0 评论 -
python从文件读取列表
def getplace(): path = "p.ini" #txt = open(path, "r", encoding="UTF-8") txt = open(path, "r", encoding="utf-8-sig") for line in txt.readlines(): # txt.readlines()读取整个文件,返回数据中每一行有\n存在,需使用line.strip去掉 # readlines()方法读取整个文原创 2022-04-01 19:03:35 · 4865 阅读 · 0 评论 -
python pdfplumber 转换多页PDF表格为Excel
import pdfplumber as primport pandas as pdpdf = pr.open('21.PDF')ps = pdf.pagesi1 = 0table1 = [[0 for i in range(20)] for j in range(200)]for p in range(9): pg = ps[p] tables = pg.extract_tables() table = tables[0] print(table) df原创 2022-02-23 18:33:10 · 1768 阅读 · 0 评论 -
ScratchSpider sb-downloader github
#!/usr/bin/env python3# -*- coding: utf-8 -*-from lxml import etreeimport requestsimport reimport os, sys, tracebackimport jsonimport zipfiledef requestsget(url_1, headers): proxies = {'https': 'http://127.0.0.1:8580'} response = requests.原创 2021-11-06 08:55:15 · 122 阅读 · 0 评论 -
python multiprocessing ftp/http download
from ctypes.wintypes import DOUBLEfrom multiprocessing import Poolimport os, time, randomfrom ftplib import FTPimport datetime#from ftplibnsf import FTPimport os, timeimport multiprocessingimport gcimport threadingimport sysimport random, reque原创 2021-10-07 17:34:34 · 192 阅读 · 0 评论 -
copy xpath
原创 2021-10-07 17:29:56 · 502 阅读 · 0 评论 -
ArchLinux-table mirror 爬虫
import requestsfrom lxml import etreefrom selenium import webdriver#//lxml需要下载(pip install lxml)def getone2( url): try: text = requests.get(url, timeout=2).text html = etree.HTML(text) #获取到网页中的html hrefs = html.xpa原创 2021-10-07 17:23:37 · 112 阅读 · 0 评论 -
ubuntu/+cdmirrors 爬虫
import requestsfrom lxml import etree#//lxml需要下载(pip install lxml)def getone2( url): try: text = requests.get(url, timeout=2).text html = etree.HTML(text) #获取到网页中的html hrefs = html.xpath("//a/@href") f=open(原创 2021-10-07 17:04:20 · 88 阅读 · 0 评论 -
python pywifi scan
```pythonimport pywifiimport timewifi = pywifi.PyWiFi()iface = wifi.interfaces()[0]iface.scan() time.sleep(8)bsses = iface.scan_results()for pjwifi in bsses: print(pjwifi.ssid) print(pjwifi.bssid) print(pjwifi.signal) print(pjw.原创 2021-02-08 11:23:14 · 318 阅读 · 0 评论 -
Pandas: Find maximum values & position in columns or rows of a Dataframe求Dataframe中行列的最大值
Pandas: Find maximum values & position in columns or rows of a Dataframe求Dataframe中行列的最大值https://thispointer.com/pandas-find-maximum-values-position-in-columns-or-rows-of-a-dataframe/df.max(a...转载 2019-06-20 05:00:40 · 1037 阅读 · 0 评论 -
nest expression & Pyparsing
http://pyparsing.wikispaces.com/http://bbs.csdn.net/topics/330052586C++ boost "]*?|(?R))*>" str = ">sdaf>">>> from pyparsing import nestedExpr>>> data2 = " >d>">>> print nested原创 2014-07-31 06:13:03 · 1084 阅读 · 0 评论 -
python TypeError: 'builtin_function_or_method' object is not iterable keys
statinfo = os.stat( OneFilePath ) if AllFiles.has_key( statinfo.st_size ): OneKey = AllFiles[ statinfo.st_size ] OneKey.append( OneFilePath )原创 2015-08-10 00:06:28 · 11564 阅读 · 1 评论 -
singlefile.py
#! encoding=utf-8import osimport os.pathAllFiles = {}MinSize = 8100def OneDir( DirName ): if DirName[len(DirName)-1] DirName = DirName + "\\" tmpFiles = os.listdir(原创 2015-08-10 07:03:33 · 700 阅读 · 0 评论 -
looking for thunder link
#! encoding=gbkimport refile_object = open('1.txt')f = open("2.txt","w")for line in file_object: m = re.findall('(thunder(.+)pa)',line) if m: print >> f,m[0][0];f.close()file_原创 2016-03-26 21:25:13 · 1162 阅读 · 0 评论 -
python简单浮点数匹配
>>> import re>>> m=re.findall('\d+\.\d+','-A213330.00-0.13')>>> m['213330.00', '0.13']>>> len(m)2>>> m=re.findall('[-]\d+\.\d+','-A213330.00-0.13')>>> m['-0.13']>>> m=re.findall('[-]原创 2016-03-27 09:15:37 · 4379 阅读 · 0 评论 -
extract things from text files
#coding=utf-8#!/usr/bin/pythonimport osfrom glob import globimport refo = open("foo.csv", "a+") def isDigit(my_str): try: float(my_str) except ValueError:原创 2016-03-27 11:32:39 · 296 阅读 · 0 评论 -
extract things from excel files.
#coding=utf-8#!/usr/bin/pythonimport osfrom glob import globimport reimport xlrdfo = open("foo.csv", "a+") def isDigit(my_str): try: float(my_str) except ValueError:原创 2016-03-28 07:43:14 · 348 阅读 · 0 评论 -
read excel files with python and xlrd
#coding=utf-8#!/usr/bin/pythonimport xlrddata = xlrd.open_workbook('160321.xls')table = data.sheets()[0]a=table.col_values(3)print(a[1])print(a[2])b=float(a[1])+float(a[2])print(b)print(tab原创 2016-03-28 07:44:45 · 388 阅读 · 0 评论 -
python pil grab screen
from PIL import ImageGrabimport datetimeimport ospath = os.getcwd()pic = ImageGrab.grab()pic.save(path+'\\'+datetime.datetime.now().strftime('%y%m%d%H%M%S')+'.jpg', format='JPEG', quality=100)h转载 2016-04-16 19:09:29 · 1302 阅读 · 0 评论 -
Jupyter Magic –用%pdb调试程序
http://blog.csdn.net/sun_shengyun/article/details/52756633https://www.zybuluo.com/hanxiaoyang/note/53429614、Jupyter Magic –用%pdb调试程序Jupyter 有自己的调试界面The Python Debugger (pdb),使得进入函数内部检查错误成为可能。 Pdb中可使用的...转载 2018-02-25 08:04:17 · 2273 阅读 · 0 评论 -
debugging python with IDLE
1. start IDLE“Python 2.5”→“IDLE(Python GUI)”2. open your source file windowFrom python shell, select file->open...3. show debug controlFrom python shell, select Debug->Debuger4.原创 2014-06-28 08:37:34 · 1321 阅读 · 0 评论