码迷,mamicode.com
首页 >  
搜索关键字:python    ( 135041个结果
【Python】读取命令行参数、在PyDev中设置Python运行时的参数
有时候,我们写的命令行程序需要批次执行,这里可以让Python程序读取命令行参数,再编写一个命令行批次执行脚本.bat,实际上就是一个充满命令的、改了后缀名的文本文件,在多个测试用例扔进Python程序中是非常有用的。 例如,如下图,有一个cmdArgs.py程序,当在python cmdArgs.py 后面带上-h -i,程序则输出-h与-i参数,后面所带内容: 如果输入其它参数,比...
分类:编程语言   时间:2015-08-05 20:29:26    阅读次数:199
python 使用新训练好的模型进行分类
6、在python中使用已经训练好的模型。Caffe只提供封装好的imagenet模型,给定一副图像,直接计算出图像的特征和进行预测。首先需要下载模型文件。Python代码如下:from caffe import imagenetfrom matplotlib import pyplot# Set ...
分类:编程语言   时间:2015-08-05 20:22:00    阅读次数:602
【Python】 条件判断 与 循环 与dict和set
# 条件判断elif: else if 的作用注意: : 【冒号】BMI =w/(h*h)if BMI10: n-1 print(n)二、n = 20while n > 10: n = n-1 print('1',n)一和二的不同,,,#dict和setdict 字典 dic...
分类:编程语言   时间:2015-08-05 20:18:34    阅读次数:150
复制virtualenv环境到其他服务器环境配置的方法
要在n多服务器端部署python的应用,虽然python本身是跨平台的,当时好多第三方的扩展却不一定都能做到各个版本兼容,即便是都是linux,在redhat系列和ubuntu系列之间来回导也是个很让人头痛的事. 找到这个virtualenv,整个的clone一个python环境,可以在这个虚出来的...
分类:其他好文   时间:2015-08-05 20:08:22    阅读次数:618
WSGI学习系列Pecan
Pecan Introduce Pecan was created to fill a void in the Python web-framework world. A very lightweight framework that provides object-dispatch style.....
分类:其他好文   时间:2015-08-05 20:06:43    阅读次数:406
Data manipulation primitives in R and Python
Data manipulation primitives in R and PythonBoth R and Python are incredibly good tools to manipulate your data and their integration is becomingincre...
分类:编程语言   时间:2015-08-05 20:00:56    阅读次数:299
Python中eval带来的潜在风险
0x00 前言eval是Python用于执行python表达式的一个内置函数,使用eval,可以很方便的将字符串动态执行。比如下列代码:>>> eval("1+2") 3 >>> eval("[x for x in range(10)]") [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]当内存中的内置模块含有os的话,eval同样可以做到命令执行:>>> import os >>> e...
分类:编程语言   时间:2015-08-05 18:38:33    阅读次数:159
Python 之 向上取整、向下取整以及四舍五入
python 向上取整ceil 向下取整floor 四舍五入round,相面给出源码示例. import math #向上取整 print "math.ceil---" print "math.ceil(2.3) => ", math.ceil(2.3) print "math.ceil(2.6) => ", math.ceil(2.6) #向下取整 print "\nmath.floor-...
分类:编程语言   时间:2015-08-05 18:34:15    阅读次数:136
【Python】 list和tuple
list 类型,这不就是js里的数组吗,,最后一个元素索引是 -1list是一个可变的有序的表,#追加.append('admin')#插入.insert(1,'admin')#删除末尾元素.pop()#删除指定位置元素.pop(1)####多维数组 list内包含list p=['a','b','...
分类:编程语言   时间:2015-08-05 18:15:41    阅读次数:116
python log
python的日志模块为logging,它可以将我们想要的信息输出保存到一个日志文件中。# cat log import logginglogging.debug('This is debug message')logging.info('This is info message')logging....
分类:编程语言   时间:2015-08-05 18:07:15    阅读次数:184
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!