学习python循环语句,四种方法实现做九九乘法表。defjiujiuWhile(a):
‘‘‘useWHILEforloop‘‘‘
i=1
whilei<=a:
j=1
whilej<=i:
print"%dX%d=%d\t"%(j,i,i*j),
j+=1
i+=1
printdefjiujiuFor(a):
‘‘‘useFORforloop‘‘‘
foriinrange(1,a+1):
forjinrange(1,i+1):
print"%dx%d=%..
分类:
编程语言 时间:
2014-08-21 15:19:24
阅读次数:
193
一:cmd介绍引用python的官方文档Thecmdclassprovidesasimpleframeworkforwritingline-oriented
commandinterpreters.Theseareoftenusefulfortestharnesses,administrative
tools,andprototypesthatwilllaterbewrappedinamoresophisticated
interfacecmd是一个提供一种基于面向..
分类:
编程语言 时间:
2014-08-21 15:09:54
阅读次数:
258
在TCP连接开始到结束连接,之间可能会多次传输数据,也就是服务器和客户端之间可能会在连接过程中互相传输多条消息。理想状况是一方每发送一条消息,另一方就立即接收到一条,也就是一次write对应一次read。但是,现实不总是按照剧本来走。...
分类:
Web程序 时间:
2014-08-21 15:06:14
阅读次数:
321
感觉在向PYTHON学一些数组方面的功能。package mainimport "fmt"func main() { var myArray [10]int = [10]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} var mySlice []int = myAr...
分类:
其他好文 时间:
2014-08-21 14:44:14
阅读次数:
164
twisted的Protocol.datareceived()能处理接收到的原始数据,既然是原始的,就可能和应用层定义的“包”有差异,即粘包和分包难以避免 ????看一段处理粘包的代码:? ? #!/usr/bin/env?python
#cod...
分类:
编程语言 时间:
2014-08-21 13:31:14
阅读次数:
355
类的成员变量在Python里描述数据结构是使用类成员变量的方式,从上面的例子可以看到这样描述:self.wndClass = WNDCLASSEX()这行代码是写在类的构造函数里,通过使用类自身对象self来给类添加成员变量wndClass 。由于在Python语言里没有声明,每增加一个类成员变量,就是通过赋值的方式产生。不过,要注意的是Python语言里的成员变量是可以动态添加的,不但可以在构造...
分类:
其他好文 时间:
2014-08-21 13:21:54
阅读次数:
197
python在交互模式下,输入命令的时候按tab键就按时间tab键的功能输出,在书写python时多有不便。把下面的代码写入一个文件tab.py,放到/usr/lib/python2.6/site-packages/下#!/usr/bin/envpython
importsys
importreadline
importrlcompleter
importatexit
importos
readline.p..
分类:
编程语言 时间:
2014-08-21 11:43:45
阅读次数:
235
Problem 31
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to ...
分类:
其他好文 时间:
2014-08-21 11:30:04
阅读次数:
169
在ubuntu上使用uwsgi部署CherryPy的应用...
分类:
其他好文 时间:
2014-08-21 11:28:34
阅读次数:
197