Skip to content

Instantly share code, notes, and snippets.

最近研究了下pythonwebkit,于是就想如果可以在python中运行js 还有操作dom 那该多好啊,于是google了一翻,发现了一些比较有用的资料(Python Webkit DOM Bindings),pythonwebkit 的开发版本已经支持dom的操作,不过需要你编译最新的源代码,这样的话你就可以获得一些额外的函数来进行dom的操作.
官方介绍的步骤:
1,git clone git://git.savannah.gnu.org/pythonwebkit.git
// 这个方法是获取pythonwebkit 的源代码,
//如果你已经安装了pythonwebkit可以先卸载掉
2,git checkout -b python_codegen
// checkout python_codegen 分支,请确定你一定要在python_codegen 分支上
//这个是以后你成功的关键 可以通过 git branch 来确定你在哪个分支上
#!/usr/bin/python
#-*-coding:utf-8-*-
import types
from w3lib.html import remove_entities
from urlparse import urlparse, urljoin
NULL = [None,'null']
list_first_item = lambda x:x[0] if x else None
@myjack
myjack / gist:5403563
Created April 17, 2013 11:31
一个可以遍历制定目录所有文件夹的程序 对制定目录文件 压缩解压 等操作
#!/usr/bin/python
#-*-coding:utf8-*-
import os
import sys
import getopt
import zipfile
from pprint import pprint
from pprint import pprint