
python
sonia_liss
这个作者很懒,什么都没留下…
展开
-
python3中如何表示无穷大
正无穷float("inf") 负无穷 float('-Inf')验证 float('-Inf') ==-float('Inf') true_isnan(double x); //判断是否为NAN _finite(double x); //判读是否为无穷大原创 2020-05-28 11:26:51 · 4046 阅读 · 0 评论 -
Python3 创建数组
创建2维数组python3 Python 3.7.4 (default, Aug 13 2019, 20:35:49) [GCC 7.3.0] :: Anaconda, Inc. on linuxType "help", "copyright", "credits" or "license" for more information.>>> len =5>>> matrix = [None]*len>>> print(matrix)[No原创 2020-05-28 11:22:39 · 1727 阅读 · 0 评论 -
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] 权限不够: /opt/conda/miniconda
问题pip install esrallyCollecting esrally Using cached https://files.pythonhosted.org/packages/eb/ca/371dcc49c7abcdb1bc8fec8aa76467658c891d935f0c2967137ff036a324/esrally-1.4.1-py3-none-any.whlCollecting docutils<0.16,>=0.10ERROR: Could not insta原创 2020-05-26 16:25:08 · 605 阅读 · 0 评论 -
cannot find lxml2处理
python3安装依赖包出现错误:cannot find lxml2没有找到libxml2库:检查是否安装lxml2 find / -name libxml2*如果没有:直接用yum install libxml2,安装如果有:且查找是显示下列文件,则需要去软链libxml2库cd /usr/lib64ln libxml2.so.2 libxml2.so...原创 2019-12-09 14:41:58 · 1168 阅读 · 0 评论 -
linux安装miniconda3
1、下载下载地址:https://docs.conda.io/en/latest/miniconda.html清华软件镜像站 https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/注意:一定要认准版本,最好不要下载miniconda,建议下载miniconda3.2、安装下载完成后:Miniconda3-latest...原创 2019-12-06 17:22:33 · 10848 阅读 · 3 评论 -
python获取shell语句的结果
import os, re#execute command, and return the outputdef execCmd(cmd):r = os.popen(cmd)text = r.read()r.close()return text#write “data” to file-filenamedef writeFile(filename, data):f = open(f...原创 2019-11-05 14:13:39 · 505 阅读 · 0 评论 -
python3读取redis返回数据带有'b'的问题
这里我们存进去的是字符串类型的数据,取出来却是字节类型的,这是由于python3的与redis交互的驱动的问题,Python2取出来的就是字符串类型的。为了得到字符串类型的数据,你可以每次取出来decode一下,但是太繁琐了,可以这样设置:sr = StrictRedis(host=‘localhost’, port=6379, db=0,decode_responses=True)即在连接...原创 2019-11-05 14:04:41 · 1384 阅读 · 0 评论 -
致命错误:libxml/xmlversion.h:没有那个文件或目录 #include "libxml/xmlversion.h"
python 安装错误记录:> cpp -o build/temp.linux-x86_64-3.6/dragnet/blocks.o cc1plus:> 警告:command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but> not for C++ [默认启用] dragnet/blocks.cpp:48...原创 2019-11-05 10:37:30 · 2765 阅读 · 1 评论 -
如何查找python安装包的路径
如何查找python安装包的路径site-packages?使用命令:python -m sitepython -m site --user-site原创 2020-04-22 18:01:15 · 2064 阅读 · 0 评论 -
python如何进行字符串截取
利用字符串子串的方式进行截取 str = "Iamabeautifulgirl" print (str[0:3]) # 截取第一位到第三位的字符 >>> Iam print (str[:]) # 截取字符串的全部字符>>> Iamabeautifulgirlprint (str[6:]) # 截取第七个字符到结尾>>>...原创 2019-07-17 18:06:30 · 1755 阅读 · 0 评论 -
python 如何把字符串转换成浮点数
如何把字符串型数字‘123.456’转换成float型数据直接自带float就行啦 test1 ="123.456" test2 = '12.304' test3 = '12.34' print(float(test1)) print(float(test2)) print(float(test3)) 结果:123.45612.30412.34如何使用map和reduc...原创 2019-07-17 17:43:55 · 62526 阅读 · 0 评论