![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
鹿海园
为自己而奋斗
展开
-
python 切片的理解(负切片)
切片(slice)是python很基础的东西了,虽然一直在使用这个功能,但是遇到切片含有负数的时候总是有点糊涂要查查手册来确认一下,今天就来看看怎么理解负切片 切片的格式是这样的: X[start: end: step] 首先,这里的start和end 表示的是切片的开始位置和结束位置,step表示步长, 当步长step为负数时,因为要逆序取,所以start必须要比end 大才能取到值,不然返回空!! a=[0,1,2,3,4,5,6] x=a[1:4:-1] >>[] 当然因为star转载 2021-09-09 17:07:42 · 1589 阅读 · 0 评论 -
pycharm执行python时报错,Intel的mkl服务包如何安装?
报错信息 D:\anaconda\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by P.转载 2021-04-09 09:57:07 · 4364 阅读 · 0 评论 -
Python学习:split()方法以及关于str.split()[0]等形式内容的详细讲解
str.split(str="", num=string.count(str)). 参数: str – 分隔符,默认为所有的空字符,包括空格、换行(\n)、制表符(\t)等。 num – 分割次数。默认为 -1, 即分隔所有。 返回值: Python split() 通过指定分隔符对字符串进行切片,如果参数 num 有指定值,则分隔 num+1 个子字符串 返回分割后的字符串列表。 代码示例: 输入 str = "Line1-abcdef \nLine2-abc \nLine4-abcd"; pr.转载 2020-05-18 14:18:28 · 10635 阅读 · 3 评论