This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
最近研究了下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 来确定你在哪个分支上 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#-*-coding:utf8-*- | |
import os | |
import sys | |
import getopt | |
import zipfile | |
from pprint import pprint | |
from pprint import pprint |