创建List:L = ['Adam', 'Lisa', 'Bart', 'Gechong', 'Kongming']显示List:L[0]遍历List:print (L)和for循环更新List:append()和insert()和直接赋值删除List:pop()和pop(n)List特点:可以添加...
分类:
编程语言 时间:
2014-10-23 16:03:55
阅读次数:
208
def get_CDF(numList): print "total number of numList %d"%len(numList) numArray = np.asarray(numList) dx = .01 bins_array = np.arange(-0.5,1.5,dx) his....
分类:
编程语言 时间:
2014-10-23 15:47:03
阅读次数:
341
from sys import argvscript, filename = argvtxt = open(filename)print "Here's your file %r:" % filename print txt.read()print "Type the filename again:...
分类:
其他好文 时间:
2014-10-23 14:03:25
阅读次数:
129
1 --==============================事务=============================== 2 --简单的事务 3 --Messages:1 2 4 6 4 print 1 5 --事务开始 6 BEGIN TRAN 7 8 --插入一...
分类:
数据库 时间:
2014-10-23 14:02:07
阅读次数:
236
from sys import argvscript, user_name = argvprompt = '> 'print "Hi %s, I'm the %s script." % (user_name, script)print "I'd like to ask you a few quest...
分类:
其他好文 时间:
2014-10-23 13:58:52
阅读次数:
170
age = raw_input("How old are you? ")height = raw_input("How tall are you? ")weight = raw_input("How much do you weigh? ")print "So, you're %r old, %r ...
分类:
其他好文 时间:
2014-10-23 12:21:22
阅读次数:
227
什么是setdict的作用是建立一组 key 和一组 value 的映射关系,dict的key是不能重复的。有的时候,我们只想要 dict 的 key,不关心 key 对应的 value,目的就是保证这个集合的元素不会重复,这是,set就派上用场了。set 持有一系列元素,这一点和 list 很像,...
分类:
编程语言 时间:
2014-10-23 10:37:41
阅读次数:
145
1、问题: 下午有同学问了这么一个问题: tail -n +$(tail -n1 /root/tmp/n) -F /root/tmp/ip.txt 2>&1| awk ‘ARGIND==1{i=$0;next}{i++;if($0~/文件已截断/){i=0};print $1"---"i;print i >> "/root/tmp/n"}‘ /...
分类:
系统相关 时间:
2014-10-23 07:04:31
阅读次数:
386
...其实, 这功能也没什么用。就是查询一个项目总的代码行数。玩玩倒是可以。方法:在终端下面依次输入:cd 项目文件find . "(" -name "*.m" -or -name "*.mm" -or -name "*.cpp" -or -name "*.h" -or -name "*.rss" ")" -print | xargs wc -l...
分类:
移动开发 时间:
2014-10-23 00:03:46
阅读次数:
226
Python中的装饰器的概念经常会让人搞得一头雾水,所以今天就好好来分析一下python中的装饰器.先看一个简单的装饰器用法: 1 def decorator(func): 2 print("this is wrapper") 3 4 def wrapper(): 5 ...
分类:
编程语言 时间:
2014-10-22 23:21:38
阅读次数:
264