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

Python入门的36个例子 之 24

# 027
toolName = 'Google'
if toolName.startswith('Go'):
print 'The tool\'s name starts with \"Go\".'
if 'oo' in toolName:
print 'The tool\'s name contains the stirng "oo".'
print toolName.find('gl') # 返回首次出现“gl”字符串的索引
if toolName.find('Baidu'):
print 'Can\'t find "Baidu" in tool\'s name.'
aList = ['a','b','c']
print '...'.join(aList)
output:
The tool's name starts with "Go".
The tool's name contains the stirng "oo".
3
Can't find "Baidu" in tool's name.
a...b...c


相关文档:

python url

djangoproject python 3 prog python code http://wiki.python.org/moin/WebBrowserProgramming http://wiki.woodpecker.org.cn/moin/ http://www.okpython.com/viewlist-fid-5.html http://zh.wikipedia.org/wiki/CPython django doc douban ibm python doc ibm python zope http://www.czug.org/ http://www.apolov ......

Python模块学习

  StringIO的行为与file对象非常像,但它不是磁盘上文件,而是一个内存里的“文件”,我们可以将操作磁盘文件那样来操作StringIO。一个简单的例子,让你对StringIO有一个感性的认识: 1  #coding=gbk 2    3  import StringIO, cStringIO, sys 4    5  s ......

学习《Python语言入门》第五章 模块

模块这东西好像没什么好讲的,无非是保存一份文件,然后在另一份文件中用import 和from ** import **(*)就行了。
这一章主要讲到了细节,导入模块Python里面是什么处理的,import 和 from ** import **有什么不一样。还有就是增加了reload()这个函数的使用说明。
以前看到哪里说尽量使用import而不要使用from ** import * ......

Python入门的36个例子 之 22

源代码下载:下载地址在这里
# 025
# 序列的神奇之处在于你可以使用相同的方式tuple、list和string
se = ['a', 'b', 'c', 'd']
li = ['a', 'b', 'c', 'd']
tu = ('a', 'b', 'c', 'd')
string = 'abcd'
print se[1]
print li[1]
print tu[1]
print string[1]
# 序列的另外一个神奇之处在于,你可以使用负数进行索 ......

Python入门的36个例子 之 23

源代码下载:下载地址在这里
# 026
aList = ['1','2','3','4']
aListCopy = aList # 其实,这里仅仅复制了一个引用
del aList[0]
print aList
print aListCopy # 两个引用指向了了同一个对象,所以打印结果一样
aListCopy = aList[:] # 这是复制整个对象的有效方法
del aList[0]
print aList
print aListCopy
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号