您的位置:首页 > 编程语言 > Python开发

python的Tidy工具安装

2016-07-23 14:51 447 查看
Tidy是用来修复不规范/随意的HTML文档的工具,可以修复HTML代码中普通的错误,确保文件的格式是正确的

安装步骤:

1、先去https://pypi.python.org/pypi/pytidylib    下载pytidylib

(或者直接在系统命令行下输入:

按enter等待它自行下载安装)

2、再去http://www.paehl.com/open_source/?HTML_Tidy_for_Windows 下载LIBTIDY
DLL

最后附上《python基础教程》里的一个用tidy的例子:

from subprocess import Popen,PIPE

text=open('Exam.html').read()
tidy=Popen('tidy',stdin=PIPE,stdout=PIPE,stderr=PIPE,shell=True)
#print tidy

tidy.stdin.write(text)
tidy.stdin.close()

print tidy.stdout.read()


该程序对文件运行Tidy,然后打印结果。读者可自行运行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python Tidy