码迷,mamicode.com
首页 >  
搜索关键字:print    ( 43532个结果
python 反射
1.根据字符串来导入模块。2.根据模块来使用函数。>>> module_name='sys'>>> mo=__import__(module_name)>>> mo>>> print mo.path['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat...
分类:编程语言   时间:2016-01-06 00:00:37    阅读次数:478
[learning scala] collections
object SparkTest005 { def main(args: Array[String]): Unit = { /** * Chapter 5 functions */ def jump(title: String = ""): Unit = print...
分类:其他好文   时间:2016-01-05 22:31:30    阅读次数:242
python注释
初学python习得注释方法如下:#我是注释print("hello")'''我是多行注释!'''其实就是#号和三个单引号(也可以双引号)啦看下面:这注释其实是表示py文件为utf-8编码,不然默认ASKII码保存文件#coding=utf-8
分类:编程语言   时间:2016-01-05 22:30:52    阅读次数:178
Python ===if while for语句 以及一个小小网络爬虫实例
if分支语句>>> count=89>>> if count==89: print count89 #单分支>>>#coding:utf-8count=int(raw_input('请输入一个数字'))print countif count>80: print '比80大'else: if coun...
分类:编程语言   时间:2016-01-05 20:30:03    阅读次数:191
python数据类型详解
目录1、字符串2、布尔类型3、整数4、浮点数5、数字6、列表7、元组8、字典9、日期1、字符串1.1、如何在Python中使用字符串a、使用单引号(')用单引号括起来表示字符串,例如:str='this is string';print str;b、使用双引号(")双引号中的字符串与单引号中的字符串...
分类:编程语言   时间:2016-01-05 20:24:30    阅读次数:207
mysql备份数据库,导入数据sql
#!/bin/bash##set-xsql=/home/scriptsdbuser=rootdbpasswd=yzg1314520nowtime=$(date+%Y%m%d%H%M)serverlist=`cat/home/serverlist|awk‘{print$2}‘`sql_tar_export(){cd$sql/$P/mysqlbakmysqldump-u$dbuser-p$dbpasswd$dbname-Rtest>$nowtime.test.sqltar-zcf$nowtime.test...
分类:数据库   时间:2016-01-05 19:06:08    阅读次数:245
Caffe学习系列(15):mean
#!/usr/bin/env pythonimport numpy as npimport sys,caffeif len(sys.argv)!=3: print "Usage: python convert_mean.py mean.binaryproto mean.npy" sys....
分类:其他好文   时间:2016-01-05 15:21:20    阅读次数:361
awk统计
eg:把当前系统使用率最高的前10个命令的命令名输出,并统计命令使用的次数。awk‘{comm[$1]++}END{for(iincomm){printi,comm[i]}}‘/root/.bash_history|sort-rnk2|head或者awk‘{print$1}‘/root/.bash_history|sort|uniq-c|sort-nr|head
分类:其他好文   时间:2016-01-05 11:03:22    阅读次数:153
python 十进制 十六进制
把十六进制的字串转为十进制数字:>>> print int('ff', 16) 255 把十进制数字转换为以十六进制表示之字串,可调用内置的hex()函数:>>> print hex(255) 0xff 调用BinAscii模块其中的b2a_hex()函数,可把以ASCII编码的文字以十六进制表示:...
分类:编程语言   时间:2016-01-05 10:57:31    阅读次数:161
Python: How to iterate list in reverse order
#1for index, val in enumerate(reversed(list)): print len(list) - index - 1, val#2def reverse_enum(L): for index in reversed(xrange(len(L))): ...
分类:编程语言   时间:2016-01-04 23:52:23    阅读次数:190
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!