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

python两个dict相加


>>> a = {'1':'2'}
>>> b = {'3':'4'}
>>> a+b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'
>>> a.update(b)
>>> a
{'1': '2', '3': '4'}
>>>
该方法把b的元素加入到a中去,键字重复时会覆盖a中的键值


相关文档:

Python: 使用装饰器“@”取得函数执行时间

  Python中可以使用装饰器对函数进行装饰(或说包装),利用这个特性,可以很方便、简洁地解决一些问题,比如获得函数执行时间的问题。
  首先,我们定义一个函数,如下:
  def exeTime(func):
def newFunc(*args, **args2):
t0 = time.time()
print "@%s, {%s} start" % (time.strftime("%X", time.local ......

python PIL 批量处理处理图片

客户给一堆图片要传到后台,图片太大了,上百张图用photoshop改太慢,就想到用python写个简单的批处理。功能简单就是把原图按比例缩小,代码更简单 20多行。
# -*- coding: cp936 -*-
import Image
import glob, os
#图片批处理
def timage():
for files in glob.glob('D:\\1\\*.JPG'):
filepath,filena ......

Python笔记(7)

  一个Python脚本的开发全过程
问题:完成一个可以为我们所有的重要程序做备份的程序。
步骤拆解:
需要备份的文件和目录由一个列表指定。
文件备份成一个zip文件。
zip存档的名称是当前的日期和时间。
我们使用标准的zip命令,它通常默认地随Linux/Unix发行版提供。Windows用户可以使用Info-Zip程序。注意 ......

Python IDE and GUI Framework for Windows

Pythonwin - Python IDE and GUI Framework for Windows.
Copyright 1994-2006 Mark Hammond
Python is Copyright (c) 2000-2008 ActiveState Software Inc.
Copyright (c) 2001-2008 Python Software Foundation.
All Rights Reserved.
Copyright (c) 2000 BeOpen.com.
All Rights Reserved.
Copyright (c) 1995-20 ......

python 字节码指令列表

/***********************************************************
KVS:文件:opcode.h
swith字节码指令的文件:ceval.c
************************************************************/
/* KVS:字节码指令列表Instruction opcodes for compiled code */
#define STOP_CODE 0
#define POP_TOP  1
#def ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号