上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页
摘要: Python assert(断言)用于判断一个表达式,在表达式条件为 false 的时候触发异常。 语法格式如下: assert expression 等价于: if not expression: raise AssertionError assert 后面也可以紧跟参数: assert expr 阅读全文
posted @ 2020-02-09 23:25 腹肌猿 阅读(936) 评论(0) 推荐(0) 编辑
摘要: 库安装 安装selenium库 pip3 install selenium 驱动安装 运行python代码时报错:selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be 阅读全文
posted @ 2020-02-07 23:59 腹肌猿 阅读(505) 评论(0) 推荐(0) 编辑
摘要: 有向图 # -*- coding:utf-8 -*- def searchGraph(graph, start, end): results = [] generatePath(graph, [start], end, results) results.sort(key=lambda x:len(x 阅读全文
posted @ 2020-01-07 22:54 腹肌猿 阅读(129) 评论(0) 推荐(0) 编辑
摘要: class Node(object): def __init__(self,item): self.item = item self.child1 = None self.child2 = None class Tree(object): def __init__(self): self.root 阅读全文
posted @ 2020-01-06 00:06 腹肌猿 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 平时我们用的python IDE除了pycharm之外,还有vscode 1.下载安装python解释器 2.下载安装vscode,微软中国下载网址(windows平台)https://code.visualstudio.com/docs/?dv=win 3.装好之后打开vscode,点击右侧的扩展 阅读全文
posted @ 2020-01-04 22:47 腹肌猿 阅读(655) 评论(0) 推荐(0) 编辑
摘要: 队列是一种先进先出的数据结构,python中有queue模块来实现队列 数组实现队列: class Queue(): def __init__(self): self.entries = [] #表示队列内的参数 self.length = 0 #表示队列的长度 self.front=0 #表示队列 阅读全文
posted @ 2020-01-01 20:09 腹肌猿 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 栈是一种后进先出的数据结构 ,栈满时不能入栈,栈空时不能出栈。 python代码实现: class Stack(object): def __init__(self, limit=10): self.stack = [] #存放元素 self.limit = limit #栈容量极限 def pus 阅读全文
posted @ 2020-01-01 17:01 腹肌猿 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 在c/c++中,通过&获取变量的内存地址,通过*获取内存地址中的数据。 在python中,通过id获取变量的内存地址,那如何通过内存地址获取数据呢? import ctypes value = 'hello world' # 定义一个字符串变量 address = id(value) # 获取val 阅读全文
posted @ 2020-01-01 16:35 腹肌猿 阅读(15598) 评论(0) 推荐(4) 编辑
摘要: 最近在安装opencv时用pip install opencv-python命令,安装速度特别慢,多次试验后最终失败! 推荐安装时使用国内镜像链接 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc. 阅读全文
posted @ 2019-12-31 21:41 腹肌猿 阅读(508) 评论(0) 推荐(0) 编辑
摘要: 很多程序都有记录日志的需求,并且日志包含的信息有正常的程序访问日志还可能有错误,警告等信息输出,python的logging模块提供了标准的日志接口,可以通过它存储各种格式的日志,日志级别等级:critical > error > warning > info > debug 看下各个日志级别代表什 阅读全文
posted @ 2019-12-30 23:28 腹肌猿 阅读(650) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页