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

Python入门的36个例子 之 21

源代码下载:下载地址在这里
# 024
dict1 = {
'5064001':'Mememe',
'5064002':'tutu',
'5064003':'thrthr',
'5064004':'fofo'
}
print dict1['5064003']
# 也可以使用整型作为唯一的编号
dict2 = {
5064001:'Mememe',
5064002:'tutu',
5064003:'thrthr',
5064004:'fofo'
}
print dict2[5064003]
# 添加
dict2[5064000] = 'none'
print dict2[5064000]
del dict2[5064002]
print dict2
for ele in dict2:
print ele
for id, name in dict2.items():
print id, name

output:
thrthr
thrthr
none
{5064000: 'none', 5064001: 'Mememe', 5064003: 'thrthr', 5064004: 'fofo'}
5064000
5064001
5064003
5064004
5064000 none
5064001 Mememe
5064003 thrthr
5064004 fofo


相关文档:

最简单的 python 多线程示例

import time,thread
def test(a,b):
for i in range(a,b):
       time.sleep(1)
       print i
def start():
thread.start_new_thread(test,(1,1001))
thread.start_new_thread(test,(1000,2001))
if __name__=='__main__':
start()
......

python 获取E

E-mail主要由邮件头和邮件体两部分组成。
邮件头中的内容和我们寄信时写在信封上的内容大同小意,当然这里也包含了很多路过的“邮局”的信息了。
邮件体中的内容就是我们写的信或者包裹。
python自身包含了email模块处理可以快速的处理E-mail中的信息
import email
#打开一个文件
fp = open('email.eml', ' ......

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运算符 供重载参考

二元运算符及其对应的特殊方法
二元运算符
特殊方法
+
__add__,__radd__
-
__sub__,__rsub__
*
__mul__,__rmul__
/
__div__,__rdiv__,__truediv__,__rtruediv__
//
__floordiv__,__rfloordiv__
%
__mod__,__rmod__
**
__pow__,__rpow__
<<
__lshift__,__rlshift__
>>
_ ......

Python入门的36个例子 之 18

例1:
# _018
# This is a module (if write Chinese in a module, there will be a error)
def func1():
print 'This is function 1.'
def func2():
print 'This is function 2.'
def func3():
print 'This is function 3.'
# 019
# 使用“import”语句调用模块:
import _018_Module
_ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号