使用IDLE来帮助学习PythonPython程序员通常把内置函数称为BIF,print() BIF的作用是吧消息显示到标准输出(通常是屏幕)1 print("You can experiment with code within IDEL's shell Coool, eh?")2 if 43>4...
分类:
编程语言 时间:
2014-12-11 17:04:53
阅读次数:
347
grep -r 'GET /weixin/weixin_izp/index.html' ./chunyun.access.log > ~/access.logcat access.log |awk '{print $1}'|cut -d, -f3|sort|uniq -c > mycount.lo....
分类:
其他好文 时间:
2014-12-11 11:41:25
阅读次数:
197
# -*- coding: cp936 -*-n=['a','b','c']n.append('abcd')print '进来的元素是:',nprint 'T出的元素是:',n.pop()----------------------------不是以ABC开头的单词正则表达式importrea='a...
分类:
其他好文 时间:
2014-12-10 22:43:23
阅读次数:
184
#!/usr/bin/env pythonimport sysimport structif len(sys.argv) != 3: print "Usage: %s appname dest_file.xcent" % sys.argv[0] sys.exit(-1)APPNAME = sys.a...
分类:
Web程序 时间:
2014-12-10 22:35:46
阅读次数:
184
比较简单,直接上代码了。import MySQLdbdef showResult(res): for i in res: print iconn=MySQLdb.connect(host="localhost",user="root",passwd="12...
分类:
数据库 时间:
2014-12-10 21:08:08
阅读次数:
207
class Person: def PrintName(self): print 'Is a Person' def PrintHello(self): print 'Hello, world'per = Person()per.PrintName()print hasa...
分类:
编程语言 时间:
2014-12-10 21:02:10
阅读次数:
222
随机数,是数据处理和分析时经常要用到的。IDL 随机数:RANDOMU是0-1均匀分布RANDOMN是正态分布undefinevar是个未定义变量print,RANDOMU(undefineva,4)Matlab随机数:rand是0-1的均匀分布randn是均值为0方差为1的正态分布
分类:
其他好文 时间:
2014-12-10 19:40:24
阅读次数:
202
例题:用冒泡排序法对10个数按从小到大的顺序排序。int main(){ int i,j,t,a[10]; printf("Input 10 integers:\n"); for(i=0;ia[i+1]) { t=a[i]; a[i]=a[i+1]; a[i+1]...
分类:
编程语言 时间:
2014-12-10 17:50:45
阅读次数:
148
array_flip(array);//传递一个数组参数,对该数组的键、值进行翻转例如:$a = array( 'a', 'b', 'c');print_r(array_flip($a));//输出为:Array( [a] => 0 [b] => 1 [c] =>...
分类:
Web程序 时间:
2014-12-10 15:44:49
阅读次数:
177
package com.victor.test; import java.util.Random; public class StaticAndFinalTest { private static Random rand = new Random(47); private static int staticA = rand.nextInt(100); private final int fi...
分类:
编程语言 时间:
2014-12-10 12:44:13
阅读次数:
235