搜索到与相关的文章
Python

安装anaconda出现This Python interpreter

安装anaconda后在命令行中出现ThisPythoninterpreterisinacondaenvironment,buttheenvironmenthasnotbeenactivated.Librariesmayfailtoload.Toactivatethisenvironmentpleaseseehttps://conda.io/activation解决方式使用终端或Anaconda提示符执行以下步骤。默认情况下,活动环境---您当前使用的环境

系统 2019-09-27 17:54:25 2397

Python

python实现静态web服务器

HTTP协议简介HTTP请求1:浏览器首先向服务器发送HTTP请求,请求包括:方法:GET还是POST,GET仅请求资源,POST会附带用户数据;路径:/full/url/path;域名:由Host头指定:Host:www.sina.com以及其他相关的Header;如果是POST,那么请求还包括一个Body,包含用户数据2:服务器向浏览器返回HTTP响应,响应包括:响应代码:200表示成功,3xx表示重定向,4xx表示客户端发送的请求有错误,5xx表示服

系统 2019-09-27 17:53:33 2397

Python

(方法总结)Python 中两个字典 dict 合并 和 两个列表 list

两个字典的合并:已知字典a={'a':1,'b':2,'c':3}和b={'d':4,'e':5,'f':6}合并方法1:dict(a,**b)操作如下:>>>a={'a':1,'b':2,'c':3}>>>b={'d':4,'e':5,'f':6}>>>dict(a,**b){'a':1,'b':2,'c':3,'d':4,'e':5,'f':6}合并方法2:c={}c.update(a,**b)输出c如下:>>>a={'a':1,'b':2,'c':3

系统 2019-09-27 17:52:55 2397

Python

python学习笔记之property

#property#内置装饰器函数只在面向对象中使用frommathimportpiclassCircle:def__init__(self,r):self.r=r@propertydefperimeter(self):return2*pi*self.r@propertydefarea(self):returnself.r**2*pic1=Circle(5)print(c1.area)#圆的面积print(c1.perimeter)#圆的周长classPe

系统 2019-09-27 17:52:45 2397

Python

Python中使用md5sum检查目录中相同文件代码分享

复制代码代码如下:"""ThismodulecontainscodefromThinkPythonbyAllenB.Downeyhttp://thinkpython.comCopyright2012AllenB.DowneyLicense:GNUGPLv3http://www.gnu.org/licenses/gpl.html"""importosdefwalk(dirname):"""Findsthenamesofallfilesindirnameand

系统 2019-09-27 17:52:36 2397

Python

Python基础之数字精度

1.9//2#向下取整0.01.9/2#不取整0.95importmathmath.floor(1/2)#向下取整0math.ceil(1/2)#向上取整round(0.3)#四舍五入0round(0.8)#四舍五入1round(1.22222,2)#保留2位小数1.22“”"从数学理论上来说,四舍五入,round(10.5,0)应该进位为11,但是到了python3.5的doc中,文档变成了"valuesareroundedtotheclosestmul

系统 2019-09-27 17:51:04 2397

Python

Python3.6+selenium2.53.6自动化测试_读取excel文件

环境:编辑工具:浏览器:安装xlrd安装DDT一分析1目录结构2导入包二代码importxlrdclassExcelUtil():def__init__(self,excelPath,sheetName="Sheet1"):self.data=xlrd.open_workbook(excelPath)self.table=self.data.sheet_by_name(sheetName)#获取第一行作为key值self.keys=self.table.r

系统 2019-09-27 17:50:29 2397

Python

python爬虫---从零开始(二)Urllib库

接上文再继续我们的爬虫,这次我们来述说Urllib库1,什么是Urllib库Urllib库是python内置的HTTP请求库urllib.request请求模块urllib.error异常处理模块urllib.parseurl解析模块urllib.robotparserobots.txt解析模块不需要额外安装,python自带的库。注意:python2importurllib2response=urllib2.urlopen('http://baidu.c

系统 2019-09-27 17:50:06 2397

Python

python中字符串数组逆序排列方法总结

python中字符串数组如何逆序排列?下面给大家介绍几种方法:1、数组倒序:原始元素的倒序排列(1)切片>>>arr=[1,2,3,4,3,4]>>>print(arr[::-1])[4,3,4,3,2,1](2)reverse()>>>arr=[1,2,3,4,3,4]>>>arr.reverse()>>>print(arr)[4,3,4,3,2,1](3)reversed(arr)#返回一个倒序可遍历对象arr=[1,2,3,4,3,4]reverse

系统 2019-09-27 17:49:02 2397

Python

详解Python中的正斜杠与反斜杠

首先,"/"左倾斜是正斜杠,"\"右倾斜是反斜杠,可以记为:除号是正斜杠一般来说对于目录分隔符,Unix和Web用正斜杠/,Windows用反斜杠,但是现在Windows(一)目录中的斜杠们python读文件需要输入的目录参数,列出以下例子:path=r"C:\Windows\temp\readme.txt"path1=r"c:\windows\temp\readme.txt"path2="c:\\windows\\temp\\readme.txt"pat

系统 2019-09-27 17:47:42 2397