搜索到与相关的文章
各行各业

Zookeeper watch参照表

Watcher设置是开发中最常见的,需要搞清楚watcher的一些基本特征,对于exists、getdata、getchild对于节点的不同操作会收到不同的watcher信息。对父节点的变更以及孙节点的变更都不会触发watcher,而对watcher本身节点以及子节点的变更会触发watcher,具体参照下表。操作方法触发watcherwatcherstatewatchertypewatcherpathCreate当前节点getdata××××getchil

系统 2019-08-12 09:27:07 2151

各行各业

UESTC 1237 质因子分解

水题一枚。。#include#include#include#include#include#includeusingnamespacestd;intisprime(intb,intn){inti;for(i=b;i<=sqrt(n);i++){if(n%i==0)returni;}return1;}intres[10005];intmain(){in

系统 2019-08-12 09:26:56 2151

各行各业

[Selenium]怎样验证页面是否有无变化

验证方法:将两次的Dom结构进行对比StringbeforeStr=(String)SeleniumUtil.getInnerHTML(page.getDriver(),page.getDLGDataColumnSetting());el.click();StringnewStr=(String)SeleniumUtil.getInnerHTML(page.getDriver(),page.getDLGDataColumnSetting());Assert

系统 2019-08-12 09:26:49 2151

编程技术

hdu1195 Open the Lock (DFS)

ProblemDescriptionNowanemergenttaskforyouistoopenapasswordlock.Thepasswordisconsistedoffourdigits.Eachdigitisnumberedfrom1to9.Eachtime,youcanaddorminus1toanydigit.Whenadd1to'9',thedigitwillchangetobe'1'andwhenminus1to'1',thedigitw

系统 2019-08-12 01:32:16 2151

Python

K近邻算法的python实现

前言在K近邻的原始算法中,没有对K近邻的方法进行优化,还是遍历训练集,找到与输入实例最近的K个训练实例,统计他们的类别,以此作为输入实例类别的判断。具体的模型理论见:统计学习方法——K近邻法(原始方法)1.K近邻算法的实现在算法实现的过程中,利用的是欧氏距离进行点与点之间的距离度量。在进行数据运算的时候,没有利用numpy,而是利用Python中自带的list来进行数据的计算。defknn(x,dataSet,labels,k):distanceMemor

系统 2019-09-27 17:56:59 2150

Python

python 计算文件夹里所有内容的大小总和

计算文件夹里所有内容的大小总和递归方法'''计算文件夹的大小'''importosdefdir_file_size(path):ifos.path.isdir(path):file_size=0dir_list=os.listdir(path)fordir_nameindir_list:file_path=os.path.join(path,dir_name)ifos.path.isfile(dir_name):file_size+=os.path.get

系统 2019-09-27 17:56:49 2150

Python

python os、sys模块总结

OS模块的常见用法os.remove()删除文件os.rename()重命名文件os.walk()生成目录树下的所有文件名os.chdir()改变目录os.mkdir/mkdirs创建目录/多层目录os.rmdir/removedirs删除目录/多层目录os.listdir()列出指定目录的文件os.getcwd()取得当前工作目录os.chmod()改变目录权限os.path.basename()去掉目录路径,返回文件名os.path.dirname()

系统 2019-09-27 17:56:42 2150

Python

python技能实践系列(六)--python内置函数zip源码查看

python内置函数有两种,一种是python实现的,一种是C语言实现的。python实现的–1.直接在IDE里面按住ctrl追踪到源码。–2.使用help内置函数,例如:help(os)C语言实现的不能直接在IDE里面查看比如builtins.py里的zip,需要去Cpython源码中查看:https://github.com/python/cpython/blob/master/Python/bltinmodule.ctypedefstruct{PyO

系统 2019-09-27 17:56:18 2150

Python

python中bs4.BeautifulSoup的基本用法

导入模块frombs4importBeautifulSoupsoup=BeautifulSoup(html_doc,"html.parser")下面看下常见的用法print(soup.a)#拿到soup中的第一个a标签print(soup.a.name)#获取a标签的名称print(soup.a.string)#获取a标签的文本内容print(soup.a.text)#获取a标签的文本内容print(soup.a["href"])#获取a标签的href属性

系统 2019-09-27 17:55:49 2150

Python

014 Python基本图形绘制小结

目录一、Python基本语法元素1.1温度转换二、Python基本图形绘制2.1Python蟒蛇绘制一、Python基本语法元素缩进、注释、命名、变量、保留字数据类型、字符串、整数、浮点数、列表赋值语句、分支语句、函数input()、print()、eval()、print()格式化1.1温度转换#TempConvert.pyTempStr=input("请输入带有符号的温度值:")ifTempStr[-1]in['F','f']:C=(eval(Temp

系统 2019-09-27 17:55:09 2150