一、Python中的线程使用:Python中使用线程有两种方式:函数或者用类来包装线程对象。1、函数式:调用thread模块中的start_new_thread()函数来产生新线程。如下例:view plaincopy to clipboardprint?importtimeimportthreaddeftimer(no,interval):cnt=0whilecnt<10:print'Thread:(%d)Time:%s\n'%(no,time.ctime())time.sleep(interval)cnt+=1thread.exit_thread()deftest() Read More
posted @ 2013-01-15 17:46 godjob Views(290) Comments(0) Diggs(0) Edit
找了蛮多,这篇文章最简单实用1.使用minidom创建XML文件# -*- coding: cp936 -*-"""使用minidom生成XML1.创建Element,createElement2.添加子节点,appendChild3.创建Text,createTextNode4.创建属性,createAttribute"""from xml.dom import minidom,Node# 创建Documentdoc = minidom.Document()# 创建book节点book = doc.createElement(&qu Read More
posted @ 2013-01-15 16:10 godjob Views(796) Comments(0) Diggs(0) Edit