
python
Charlotte_DL
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
sys.srgv[]的简单使用
sys.argv[]的使用sys.argv[]说白了就是一个从程序外部获取参数的桥梁,下面就通过一个样例test.py程序来说明它的用法:#test.pyimport sysa = sys.argv[0]print(a)在命令行中输入python test.py之后返回的结果是:其argv[]中的0指代码(即此.py程序)本身的意思。然后我们将代码中0改为1 :保存后,我们在命令行中输入python test.py test1 ;返回的结果为: 现在继续修改代码:a = sys.原创 2020-05-22 16:08:08 · 518 阅读 · 0 评论 -
python中的json总结
1、json.dumps : 是将dict转成str2、json.dump:是将python数据保存成json3、json.load:是将文件中的json数据读取出来,转换成python数据类型原创 2019-06-25 20:33:44 · 226 阅读 · 0 评论 -
os.environ与os.putenv的使用
用Python Shell设置或获取环境变量的方法:一、设置系统环境变量1、os.environ[‘环境变量名称’]=‘环境变量值’ #其中key和value均为string类型2、os.putenv(‘环境变量名称’, ‘环境变量值’)二、获取系统环境变量1、os.environ[‘环境变量名称’]2、os.getenv(‘环境变量名称’)...原创 2019-05-17 11:27:48 · 4517 阅读 · 0 评论 -
简易WSGI实现
1.使用python内置WSGI server# WSGI server in Pythonfrom wsgiref.simple_server import make_serverdef application (environ, start_response): status = '200 OK' response_headers = [ ('Conten...翻译 2019-05-15 16:02:12 · 332 阅读 · 0 评论 -
operator.attrgetter()与operator.itemgetter()的用法
operator.attrgetter与operator.itemgetter的用法operator.itemgetter()的用法通过公共建对字典列表排序:operator.attrgetter()的使用对不原生支持比较操作的对象排序:总结operator.itemgetter()的用法通过公共建对字典列表排序:import operatorrows = [ {'fname': ...翻译 2019-05-06 15:47:53 · 1482 阅读 · 0 评论 -
解决:WebDriverException: 'chromedriver' executable needs to be in PATH
在 Python 中使用Selenium 包进行数据分析时,遇到一个错误:WebDriverException: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home解决方法如下:安装 selenium 的 py...原创 2019-02-22 15:22:23 · 4207 阅读 · 0 评论 -
python中itertools模块zip_longest函数
转自:https://cloud.tencent.com/info/953309e89506db76deef56a4a9a0a4e7.html最近在看流畅的python,在看第14章节的itertools模块,对其itertools中的相关函数实现的逻辑的实现其中在zip_longest(it_obj1, ..., it_objN, fillvalue=None)时,其函数实现的功能和内置...转载 2019-01-16 15:33:50 · 2133 阅读 · 0 评论 -
python代码小结
1、pwd_path_a = os.path.abspath(os.path.dirname(__file__)) ; pwd_path_b = os.path.abspath(os.path.dirname(sys.argv[0])); pwd_path_c = os.path.abspath(os.path.dirname('当前文件名')):三行代码表示的意思相同,显示当前运行文件所在的绝...原创 2019-01-03 17:27:45 · 260 阅读 · 0 评论 -
numpy中axis=0 与axis=1的区分
import numpy as npa = np.array([[1,2,3], [4,5,6], [7,8,9]])print np.amin(a)print np.amin(a,0)print np.amin(a,1)print np.amax(a)print np.amax(a,0)print np.amax(a,1)amin() 用于计算数组中的元素沿指定轴的最小值。...原创 2018-12-21 11:06:11 · 973 阅读 · 0 评论 -
numpy 数组维度操作汇总
转载:https://blog.youkuaiyun.com/weixin_38283159/article/details/78793277所有的重排原则:从原数组最深维度开始依次取元素排到转换后数组最深维度处1、reshape & resize & shape 改变数组维度reshape函数:不改变原数组维度,有返回值 resize函数:直接改变原数组维度,无返回值 sha...转载 2018-08-22 09:42:33 · 777 阅读 · 0 评论 -
python基础函数笔记
1、astype与dtype的区别:astype是转换数据类型,dtype是查看数据类型In [11]: arr = np.array([1,2,3,4,5])In [12]: arrOut[12]: array([1, 2, 3, 4, 5])// 该命令查看数据类型In [13]: arr.dtypeOut[13]: dtype('int64')// 该命令是转换数...原创 2018-08-08 17:44:58 · 277 阅读 · 0 评论 -
Python列表和Numpy数组和矩阵的区别
原文链接:点击打开链接Python列表和Numpy数组的区别: Numpy使用ndarray对象来处理多维数组,该对象是一个快速而灵活的大数据容器。使用Python列表可以存储一维数组,通过列表的嵌套可以实现多维数组,那么为什么还需要使用Numpy呢?Numpy是专门针对数组的操作和运算进行了设计,所以数组的存储效率和输入输出性能远优于Python中的嵌套列表,数组越大,Numpy的优势就越明显。...转载 2018-07-12 01:42:39 · 989 阅读 · 0 评论 -
ix & iloc &loc 的区别
原文链接:点击打开链接loc——通过行标签索引行数据 iloc——通过行号索引行数据 ix——通过行标签或者行号索引行数据(基于loc和iloc 的混合) 同理,索引列数据也是如此!举例说明: 1、分别使用loc、iloc、ix 索引第一行的数据: (1)locimport pandas as pddata=[[1,2,3],[4,5,6]]index=['a','b']#行号columns...转载 2018-06-27 23:43:47 · 325 阅读 · 0 评论