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

python_复杂数据类型

python_复杂数据类型
python中原生的队列有2种,一种是普通的队列(Queue),一种叫做优先队列(PriorityQueue),即小的先出列。
注意:队列是线程安全的,python 3.0中支持多进程,也有类似的Queue,但不是这个。
1栈、队列、堆
  python中原生的队列有2种,一种是普通的队列(Queue),一种叫做优先队列(PriorityQueue),即小的先出列。
  注意:队列是线程安全的,python 3.0中支持多进程,也有类似的Queue,但不是这个。
  构造函数:
  queue.Queue(maxsize)
  queue.LifoQueue(maxsize)
  queue.PriorityQueue(maxsize)
  异常:
  queue.Empty
  queue.Full
  方法:
  qsize()            获得队列的大小
  put_nowait(item)        入队
  get_nowait()              出队 
2 集合
  创建集合
  set(list)
  set(tuple)
  添加元素:set.add(element)
  删除元素:set.remove(element)
           set.discard(element) #如果存在,删除
           set.pop()  #随机删除元素
  清空集合:set.clear()
  集合操作:
  包含<=
  真包含<
  并union(set1,set2,...)
|
  交intersection
&
  差difference
-


相关文档:

【zz】Python常用资源网址

zz from 《可爱的Python》
http://www.woodpecker.org.cn/
Python标准库 http://www.woodpecker.org.cn:9081/doc/Python/_html/PythonStandardLib/
简明Python教程 http://www.woodpecker.org.cn:9081/doc/abyteofpython_cn/chinese/index.html
Python快速介绍 http://www.zoomquiet.org/share/s5/intropy/070322-intro ......

python实现twitter client

公司的代理可以直接穿墙,自由访问Twitter、Facebook等网站,这两天研究了一下Twitter提供的API,用python写了一个twitter client,只实现了基本功能,查看自己的twitter消息,也可以不验证,查看public的twitter消息。其他功能实现类似。主要函数如下:
def fetch_with_proxy(proxy, username, password, url):
 &n ......

Python中执行shell命令的实例

1。
myCoolVariable="some_string"
os.system("echo myCoolVariable")
2.
>>> os.system('echo "asdg"')
asdg
0
>>> os.system("echo 'asdgwere'")
asdgwere
0
3.
$ python
>>>hamburger="potato"
>>>import os
>>>os.system("echo 'hamburger'")
potato
0
......

windows下使用gcc调用python的问题

用gcc编译了一个C++调用python的程序,这个程序在VS下是好用的,而且没有使用vs的任何库
可是到了gcc下就是无法使用
后来上网查了一下资料才知道,是因为cl与gcc的运行时库不同。
打开cmd窗口,输入python就可以看到
Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] on win32
Type " ......

Python重载学习手记

今天学习了一下Python的操作符重载,总结了几点比较神奇的东东:
------------------------------------------------------------------------------------------------------------
关于iter:
Technically, iteration contexts work by calling the iter built-in function to try to
find an _ _iter_ _ method, whi ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号