Python Project
* PYTHON 趋向于将功能相近的对象放进一个MODULE(文件)里,不用担心对象会太大,因为如果对象太大了,那它可能是做的事性太多了
需要被重构、分解。
* 开发辅助工具是PYTHON的一个强项。如构建工具、统计工具等等,只要有需求,它一定办得到,因为这些应用对安全和性能要求不高,反
而对开发的简洁性有很高的乞求。
* 只把会发生意外的那一小部分放进try里,把try成功后的操作放进else里,try失败后的操作放进except里,把不管成功或失败都需要的操作
放进finally里(为什么不写在try-catch块后呢?因为这个try-catch块代表一个风险操作集合的语意)
* PYTHON中可以简化操作的内置语法有:for/else(如果for集合为空则执行else语句)
Python 是Google的3个官方语言之一,在Google的应用开发中大量应用,不过,更多的是应用在开发辅助工具上:
* The Google build system.All of Google's corporate code is checked into a repository and the dependency and building of this code is managed by python.Greg mentioned that to create code.google.com took about 100 lines of python code. But since it has so many dependencies,the build system generated a 3 megabyte
* Packaging. Google has an internal packaging format like RPM. These packages are created using python.
* Binary Data Pusher. This is the area where Alex Martelli is working, on optimizing pushing bits between thousands of servers
* Production servers. All monitoring, restarting and data collection functionality is done with python
* Reporting. Logs are analyzed and reports are generated using Python.
* A few services including code.google.com and google groups. Most other front ends are in C++ (google.com) and Java (gmail). All web services are built on top of a highly optimizing http server wrapped with SWIG.
##########################################################
Python doesn't force you into Java's nasty one-c
相关文档:
文件操作是程序设计中不可或缺的重要部分。Python通过一个内置函数open来打开文件。
open(filename,mode,buffer)
其中第一个参数是要打开的文件的文件名,必选;第二个是打开方式,可选;第三个为缓冲区,可选。默认情况下是以“读”模式打开文件。该函数 ......
python 中minidom解析xml
2009年06月26日 星期五 08:40
下面只列出一些常用的方法属性,如果要查看更多的方法, 可以去看文件minidom如何实现的。
获得Document对象
法一:
import xml.dom.minidom as m_dom
doc1 = m_dom.getDOMImplementation().createDocument(None, "root1", None)
doc1.documentElement.toxml(e ......