易截截图软件、单文件、免安装、纯绿色、仅160KB

Amusing Python 2: range/xrange

这两个基本上都是在循环的时候用。
Python
代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=for%20i%20in%20range(0%2C%20100)%3A%0A%20%20%20%20print%20i" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" height="15" width="14">
for
 i 
in
 range
(
0

100
):  
    print
 i  
for i in range
(0, 100):
print i
Python
代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=for%20i%20in%20xrange(0%2C%20100)%3A%0A%20%20%20%20print%20i" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" height="15" width="14">
for
 i 
in
 xrange(
0

100
):  
    print
 i  
for i in xrange(0, 100):
print i
  
这两个输出的结果都是
一样的,实际上有很多不同,range
会直接生成一个list对象:
Python
代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=%3E%3E%3E%20a%20%3D%20range(0%2C%2010)%0A%3E%3E%3E%20type(a)%0A%3Ctype%20'list'%3E%0A%3E%3E%3E%20a%0A%5B0%2C%201%2C%202%2C%203%2C%204%2C%205%2C%206%2C%207%2C%208%2C%209%5D%0A%3E%3E%3E%20a%5B0%5D%0A0" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/g


相关文档:

python 中 base64 压缩图片,用post传送


Including binaries in your sources
+y F J2A T&N1H f(L ]0
Sometime it's handy to include small files in your sources (icons, test files, etc.)CNOUG博客首页 P x z c W R K+x3{ N
CNOUG博客首页 h I A O$k-n P
Let's take a file (myimage.gif) and convert it in base64 (optionnaly compressing it wit ......

python图形处理库PIL(Python Image Library)


原文地址 http://www.javaeye.com/wiki/Python/1371-python-graphics-library-pil-python-image-library-introduction
关于PIL库的一些概念
pil能处理的图片
类型
pil可以处理光栅图片(像素数据组成的的块)。
通道
一个图片可以包含一到多个数据通道,如果这些通道具有相同的维数和深度,Pil允许将这些通道进行叠加 ......

python 正则表达式和re模块

正则表达式是搜索、替换和解析复杂字符模式的一种强大而标准的方法.
正则表达式(或 RE)是一种小型的、高度专业化的编程语言,(在Python中)它内嵌在Python中,并通过 re 模块实现.字符串也有很多方法,可以进行搜索 (index、find 和 count)、替换 (replace) 和解
析 (split),但它们仅限于处理最简单的情况
re 模块使 P ......

Python 元组


Python 元组
元组和列表十分类似,只不过元组和字符串一样是 不可变的 即你不能修改元组。元组通过圆括号中用逗号分割的项目定义。元组通常用在使语句或用户定义的函数能够安全地采用一组值的时候,即被使用的元组的值不会改变。
使用元组
例9.2 使用元组
#!/usr/bin/python
# Filename: using_tuple.py
zoo = ('wo ......

python学习(1)-字典 (Dictionary)

   
字典(Dictionary)是一种映射结构的数据类型,由无序的“键-值对”组成。字典的键必须是不可改变的类型,如:字符串,数字,tuple;值可
以为任何python数据类型。
1、新建字典
>>> dict1={}     
#建立一个空字典
>>> type(dict1)
<ty ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号