python
文章平均质量分 64
iteye_16821
这个作者很懒,什么都没留下…
展开
-
Jython 简单入门
[size=large][b]1. 用Jython调用Java类库[/b][/size] 第一步、创建Java类 写一个简单的Java类,用Point来示例: [code="Java"] import org.python.core.*; public class Point extends PyObject { private int x; priva...2008-12-30 19:38:04 · 323 阅读 · 0 评论 -
getopt -- Parser for command line options
getopt -- Parser for command line options This module helps scripts to parse the command line arguments in sys.argv. It supports the same conventions as the Unix getopt() function (including the sp...原创 2008-08-27 12:56:55 · 128 阅读 · 0 评论 -
python相关拾零
* python-psycopg2 - Python module for PostgreSQL * SQLAlchemy - SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of...2008-09-09 16:51:23 · 145 阅读 · 0 评论 -
13.4 shelve -- Python object persistence
[code] import shelve d = shelve.open(filename) # open -- file may get suffix added by low-level # library d[key] = data # store data at key (overwrites old data if ...原创 2008-10-05 02:22:56 · 118 阅读 · 0 评论 -
py2exe 把python脚本转成windows下可执行文件
py2exe是一个可以把python脚本转成windows下的可执行程序的模块。 py2exe扩展自disutils模块,由查看C:\Python25\Lib\site-packages\py2exe\__init__.py文件可知: [code] """ builds windows executables from Python scripts New keywords fo...2008-10-12 23:42:30 · 115 阅读 · 0 评论 -
feedparser学习摘要
号称Universal Feed Parser,通吃所有合法不合法的RSS。先简单写下使用方式: [code] >>> import feedparser >>> d = feedparser.parse('http://willzh.iteye.com/rss') >>> d['feed']['title'] u"Will's Blog" [/code] 另外这里有个使MoinMo...2008-10-13 01:22:50 · 98 阅读 · 0 评论 -
用python实现SSH的免密码输入访问客户端
[b]1. pexpect - http://pexpect.sourceforge.net/pexpect.html[/b] 代码举例: [code="Python"] import pexpect child = pexpect.spawn('ssh root@192.168.100.6 ls /home') child.expect('Password:') chil...2009-07-10 09:52:48 · 529 阅读 · 0 评论 -
readline
There are two ways to configure the underlying readline library, using a configuration file or the parse_and_bind() function. Configuration options include the keybinding to invoke completion, editing...原创 2008-12-02 23:33:47 · 90 阅读 · 0 评论 -
MoinMoin 1.5.8 上传附件的XMLRPC API实现
[b]一、服务端[/b] [b]1. 修改/usr/lib/python2.5/site-packages/MoinMoin/wikirpc.py,在class XmlRpcBase中增加如下函数:[/b] [code="python"] def xmlrpc_putAttachment(self, pagename, attachname, data): ...2009-09-22 16:44:49 · 307 阅读 · 0 评论 -
TurboGears 和 Django 的比较
TurboGears 和 Django 的比较 Django 和 TurboGears 都是 MVC 风格的框架,开发人员可以利用这些技术使用 Python 语言快速开发 Web 站点。为了选择最适合您的需求的技术,请考虑以下区别: * 背景: 这两个项目与 Ruby on Rails 一样,都是从现有的应用程序中提取出来发布到开源社区中的。Django 的历...原创 2008-08-21 22:50:25 · 430 阅读 · 0 评论 -
为心爱的MoinMoin写一个小小的Done宏
[code="Python"] ################################################### # # Author: willzh@javaeye # Date: Wed Apr 15 16:07:30 CST 2009 # GPLv3 # # import random def execute(macro, args): ...2009-04-15 16:04:05 · 589 阅读 · 0 评论 -
根据CSV文件自动形成表格的MoinMoin插件——InsertCSV
MoinMoin本身的制表语法很简单,但是如果其他软件制作好的表格又重新录入一边,就不合算了。而这些软件大都可以导出CSV格式文件,所以如果能直接上传CSV文件,自动形成表格,将会非常方便省事。 本来想自己写一个这样的插件,结果不小心发现MacroMarket上已经有了,是一个叫ShowCSV宏插件。但是这个有点“土”,我稍微改进了一下,加入了一点背景色功能,使用语法也变了,所以干脆就叫Inse...2009-02-28 00:34:04 · 537 阅读 · 0 评论 -
一则魅族M8下歌词乱码的程序小故事
最近,一朋友买了个魅族的M8手机,整天拨弄,爱不释手。一次找我说,下载了一堆lrc歌词,结果在M8里播放都是乱码,怎么回事,有没有什么解决办法。我说,好办,其实是gb2312和unicode编码的问题,给你写个python脚本就搞定一切: [code="Python"] import os import glob import codecs files = glob.glob(r'd...2009-01-20 00:41:46 · 159 阅读 · 0 评论 -
Epydoc
http://epydoc.sourceforge.net/ Epydoc is a tool for generating API documentation for Python modules, based on their docstrings. A lightweight markup language called [url=http://epydoc.s...2009-02-05 12:15:31 · 271 阅读 · 0 评论 -
python library extra
1. [b]dateutil[/b] - The dateutil module provides powerful extensions to the standard datetime module, available in Python 2.3+. [url]http://labix.org/python-dateutil[/url] 2. [b]vobject[/b...2009-02-06 00:18:59 · 101 阅读 · 0 评论 -
VObject
VObject VObject simplifies the process of parsing and creating iCalendar and vCard objects. Installation To install vobject, run: python setup.py install vobject requires the dateutil package, w...2009-02-06 00:23:00 · 323 阅读 · 0 评论 -
Darwin Calendar Server,一个开放源代码的日历服务器
[color=blue][url=http://calendarserver.org/]Darwin Calendar Server[/url][/color]是一个遵循标准的实现多用户合作共享日历信息的开放源代码服务系统,采用[color=green]python[/color]开发,基于强大的[color=olive]twisted[/color],实现了CalDAV协议──这是WebDAV协...2009-02-06 19:18:43 · 983 阅读 · 0 评论 -
如何将.py编译成.pyc/.pyo文件
使用方式如下: [code="Python"] python -O -m py_compile file.py [/code] -O 优化成字节码 -m 表示把后面的模块当成脚本运行 -OO 表示优化的同时删除文档字符串 也可以写一个脚本来实现: [code="Python"] import py_compile py_compile.compile("fi...2009-02-10 15:14:25 · 630 阅读 · 0 评论 -
PyFileMaker介绍
PyFileMaker是一个用于访问和修改FileMaker Server数据库的Python模块。它通过调用FileMaker服务器的自定义网站发布函数(Custom Web Publishing),使用XML技术与其交互数据,采用ORM方式进行开发。 点击这里阅读更多信息:[url]http://code.google.com/p/pyfilemaker/[/url] [img...2009-02-15 11:57:01 · 472 阅读 · 0 评论 -
使用appscript+python来控制Mac下的GUI应用程序
在Mac下,appscript是一个与应用程序通信交互的强大工具。用Python的appscript模块,可以在不用学习appscript的情况下也能做到与很多应用程序交互的功能。 打开Mac的终端,安装很简单: sudo easy_install appscript 然后运行ipython,先来试一个简单有趣的例子: [code="Python"] >> import osax...2009-02-15 13:28:15 · 650 阅读 · 0 评论 -
用python ctypes调用动态链接库
[b]ctypes is very cool! Great piece of work. - Just van Rossum[/b] ctypes使得python能够直接调用c语言开发的动态链接库,非常强大。 为了使用CTypes,你必须依次完成以下步骤: * 编写动态连接库程序 * 载入动态连接库 * 将Python的对象转换为ctype...2009-10-12 15:10:07 · 225 阅读 · 0 评论