while loops
定义与实例
i = 0
numbers = []
while i < 6:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % ...
分类:
编程语言 时间:
2014-06-11 00:59:17
阅读次数:
410
几个实例展示python中数据结构list的魅力!
list变量申明
the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
访问list元素
array= [1,2,5,3,6,8...
分类:
编程语言 时间:
2014-06-11 00:16:28
阅读次数:
285
新手利用python正则表达式从文件中取出文件名称给文件命名,再修改文件名以利于检索...
分类:
编程语言 时间:
2014-06-11 00:15:09
阅读次数:
469
1.os模块2.os.path 模块3.实例1. os模块
对文件系统的访问大多通过python的os模块实现,其中os 模块负责大部分的文件系统操作,包括删除/重命名文件,遍历目录树,管理文件访问权限等。
2.os.path 模块,os.path完成一些针对路径名的操作,包括管理和操作文件路径名中...
分类:
编程语言 时间:
2014-06-10 12:38:22
阅读次数:
488
一个数组由若干个整数组成,现要求:将偶数放到前面,奇数放到后面,并输出数组。提供了两种PYTHON的解法和一个RACKET解法。...
分类:
其他好文 时间:
2014-06-10 11:05:05
阅读次数:
163
Json编码,在python里就是一句话:
json.dumps(user_data)
但是Erlang没有自带的Json模块,只能自己造轮子:
先下载mochijson2:
https://github.com/mochi/mochiweb/blob/master/src/mochijson2.erl
用erlc编译
然后,上代码:
get_json_data() ->
...
分类:
Web程序 时间:
2014-06-10 06:46:21
阅读次数:
309
system.js MongoDB存储javascript函数的地方
与python配合用...
分类:
数据库 时间:
2014-06-10 06:45:42
阅读次数:
260
新手听课笔记 python中用mysqldb模块操作mysql数据库的基本应用...
分类:
数据库 时间:
2014-06-10 06:32:57
阅读次数:
202
问题描述:
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabeti...
分类:
其他好文 时间:
2014-06-10 06:13:21
阅读次数:
299
问题描述:
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn1 + Fn2,
where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
...
分类:
其他好文 时间:
2014-06-10 06:10:06
阅读次数:
307