pythonдµÄ½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z¸ñʽ
#½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z.py
#for folder all file do 7z
import os
import sys
import distutils.file_util
def ImportOkFile():
if(os.path.isfile("D:\\Records\\½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z_record.txt")==False):
f=open("D:\\Records\\½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z_record.txt","w")
f.close()
f=open("D:\\Records\\½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z_record.txt","r")
okList=f.readlines()
f.close()
doneOkList=[]
for okFile in okList:
if(okFile[:3]=="ok "):
doneOkList.append(okFile[0:-1])
return doneOkList
def RecordOkFile(file,preinfo="ok "):
f=open("D:\\Records\\½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z_record.txt","a")
f.write(preinfo+file+"\n")
f.close()
def OneLayDir(doDir):
folderfile=os.listdir(doDir)
if len(folderfile)==1 and os.path.isdir(doDir+"\\"+folderfile[0]):
firstfolder=curfolder=doDir+"\\"+folderfile[0]+"\\"
folderfile=os.listdir(curfolder)
while len(folderfile)==1 and os.path.isdir(curfolder+folderfile[0]):
folderfile=os.listdir(curfolder)
curfolder=curfolder+folderfile[0]+"\\"
try:
folderfile=os.listdir(curfolder)
except exception as e:
return Fa
Ïà¹ØÎĵµ£º
³õѧpython£¬ÏÖÔÚÒª¶ÁÒ»¸ö¶þ½øÖÆÎļþ£¬²éÕÒdocÖ»·¢ÏÖfileÌṩÁËÒ»¸öreadºÍwriteº¯Êý£¬¶øÇÒ¶ÁдµÄ¶¼ÊÇ×Ö·û´®£¬Èç¹ûÖ»ÊǶÁдcharµÈÒ»¸ö×ֽڵĻ¹ÐУ¬ÒªÏë¶ÁдÈçint,doubleµÈ¶à×Ö½ÚÊý¾Ý¾Í²»·½±ãÁË¡£ÔÚÍøÉϲ鵽һƪÌù×Ó£¬Ê¹ÓÃstructÄ£¿éÀïÃæµÄpackºÍunpackº¯Êý½øÐжÁд¡£ÏÂÃæ¾Í×Ô¼ºÐ´´úÂëÑé֤һϡ£
>>> from struct ......
¼ÈȻѡÔñÁËÔ¶·½£¬¾Í±ØÐëÈÕÒ¹¼æ³Ì http://wrsuifeng.javaeye.com
Python´úÂë
# Filename: excel.py
import os,sys,time
import win32com.client
import traceback
excel = win32com.client.Dispatch(" ......
ÆäʵÒì³£¾ÍÊDz»Õý³££¬¾ÍÊDz»ºÍÎÒÃÇÏëÏóÒ»ÑùÈ¥Ö´ÐС£ËüÊÇÒòΪ³ÌÐò³öÏÖÁË´íÎó¶øÔÚÕý³£¿ØÖÆÁ÷ÒÔÍâ²ÉÈ¡µÄÐÐΪ¡£Python³öÏÖÒì³££¬¾ÍÊÇÒòΪ¼ì²éÁËÒ»¸ö´íÎóʱ£¬Python½âÊÍÆ÷ÎÞ·¨¼ÌÐø¼ÌÐøÖ´ÐÐÏÂÈ¥£¬ÕâʱºòÅ׳öÁËÒì³£¡£ÍùÍùÕâ¸ö´íÎó·ÖΪÓï·¨ÉϺÍÂß¼ÉÏ(²»Éó¤Ëµ¸ÅÄ-_-! )£¬¿´¿´¼¸¸öÀý×Ó£¬×ܽáһϣº
1¡¢NameError£º³¢ÊÔ·ÃÎÊÒ»¸öÎ ......
def getText(self,nodelist):
rc=""
for node in nodelist:
if node.nodeType == node.TEXT_NODE or node.nodeType == node.CDATA_SECTION_NODE:
rc = rc + node.data
return rc
def parseXML(self,requesturl,xml):
dom = minidom.parse(requesturl)
for node in dom.getElementsByTagName('ca ......
ÓÉÓÚ¹¤×÷ÐèÒª£¬ÓÖҪѧϰеĿª·¢ÓïÑÔ-Python£¬ ÓïÑÔѧ¹ý¼¸ÖÖÁË£¬ ¸Ð¾õ»¹ÊÇÓкöàÏàËƵĵط½£¬ Õâ¸öPython¸Ð¾õ¾Í¸úJavaÓкöàÏàͨµÄµØ·½£¬ Ê×ÏÈÄã¿ÉÒÔÔÚEclipseÉÏͨ¹ýÅäÖúóÀ´¿ª·¢Python¡£ÕâÀïÎÒÌý´ÓÁËÀÏ´óµÄ½¨Ò飬ÅäÖÃÁËÒ»¸öFlexBuilder ×÷ΪPythonµÄIDE½øÐпª·¢¡£
Ä¿Ç°¸Õ¿ªÊ¼Ñ§Ï°PythonµÄ»ù±¾Óï·¨£¬ ½ñÌìÖ÷Òª¿´ÁËÒ»ÏÂPyth ......