perl/python
xkou
hi, 欢迎大家
展开
-
python 进行多线程编程,使用Semaphore控制线程数
#! /usr/bin/env pythonimport osimport timeimport threading# 进程函数def printthread(n): print n,"-->进程创建" for a in range(4): print a time.sleep(1) prin原创 2004-10-10 17:32:00 · 7897 阅读 · 0 评论 -
使用 python 操作 access 数据库
python 操作Access数据库首先下载 win32all at http://starship.python.net/crew/mhammond/win32/Downloads.html然后安装,下面是一个例子;import win32com.clientobjConn = win32com.client.Dispatch(rADODB.Connection)#c原创 2004-10-19 16:35:00 · 4550 阅读 · 0 评论 -
在python 中使用 windows dll
使用c/c++在windows上扩展python如何在python 中使用 windows dll首先下载 ctypes 模块 说明在 http://starship.python.net/crew/theller/ctypes/reference.html下面是我写的一个例子首先写一个dll,源码如下#include #include //----------原创 2004-10-21 11:13:00 · 1709 阅读 · 1 评论 -
安装GD成功
N:/Down/GDpm/GD-2.15>ppmPPM - Programmers Package Manager version 3.1.Copyright (c) 2001 ActiveState Corp. All Rights Reserved.ActiveState is a devision of Sophos.Entering interactive shell. Using原创 2004-10-22 11:30:00 · 1971 阅读 · 0 评论 -
在python 中使用正则表达式
http://www.amk.ca/python/howto/regex/regex.html原创 2005-02-02 16:18:00 · 1055 阅读 · 0 评论 -
[bittorrent] 从http tracker 获取peers
知道了 torrent 文件和格式,便可以利用它的 tracker 地址得到其它客户端来下载文件,查看 meta[announce]的内容,是一个 形如 http://tracker.cnxp.com:8080/announce 的地址,我们便可以向它请求来获得peers.请求包括以下几个字段: info_hash 为 torrent 文件中 info 部分进行 encode原创 2007-06-20 21:24:00 · 2633 阅读 · 1 评论 -
解决 django 查数据库时中文编码问题
开始使用 ansi 文件, 数据库使用 mysql 4.1 , Django 设置为 DEFAULT_CHARSET = utf-8默认为 utf8 编码,但查询数据库时,如果有中文就查不到结果, 因为发送的语句为 gb2312. 于是修改 数据库编码为 gb2312 , 重新导入数据. 此时查询中文还是出错, 后来搜索到是 mysqldb 中的问题 http://blo原创 2007-04-14 20:15:00 · 8501 阅读 · 0 评论 -
使用自定义代理访问 blogspot
blogspot 因为ip被禁止访问所以没法连接,可以使用另一IP, 对于特定的域名可以修改 host, 文件, 但对于任意的blogspot 站点,最方便的办法是自己控制dns,下面是一个使用 twisted 写的 dns, 可以根据需要修改 dns的指向 from twisted.internet.protocol import Factory, Protocolfrom原创 2007-06-19 21:27:00 · 2306 阅读 · 1 评论 -
使用 python 操作blog
csdnblog 提供了远程过程调用接口metablogapi 我们可以使用python 做一些相关的操作, 如发表文章,删除文章,等等 下面以csdnblog为例, 来说明一下, 如何获取分类列表; csdn blog的接口地址是 http://blog.csdn.net/xkou /services/metablogapi.aspx, 把中间xkou的 换成你的用户名就可以 调用r原创 2007-06-16 16:19:00 · 945 阅读 · 0 评论