⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 builddialectexamples.py

📁 Dive into Python 中文版
💻 PY
字号:
"""Build examples of output of dialect moduleThis script is used during the build process of "Dive Into Python"(http://diveintopython.org/) to create examples of the output of thecode in chapter 4 (dialect.py and BaseHTMLProcessor.py).It takes one argument, the source HTML file to translate.  It outputschef.html, fudd.html, and olde.html in the same directory as the source.Safe to run more than once.  Output files are silently overridden ifthey already exist."""__author__ = "Mark Pilgrim (mark@diveintopython.org)"__version__ = "$Revision: 1.2 $"__date__ = "$Date: 2004/05/05 21:57:19 $"__copyright__ = "Copyright (c) 2001 Mark Pilgrim"__license__ = "Python"import dialectimport sys, osdef translateAndWrite(filename, dialectname):	targetfilename = os.path.join(os.path.split(filename)[0], "%s.html" % dialectname)	fsock = open(targetfilename, "wb")	fsock.write(dialect.translate(filename, dialectname))	fsock.close()if __name__ == "__main__":	filename = sys.argv[1]	for dialectname in ("chef", "fudd", "olde"):		translateAndWrite(filename, dialectname)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -