python²Ù×÷excelÐÔÄÜÎÊÌâÇóÖú
http://bbs.chinaunix.net/thread-1586782-1-1.html
ÎÒ¸Õ¸ÕÓÃpythonдÁËÒ»¶Î²Ù×÷excelµÄ½Å±¾£¬Ä¿µÄÊÇ°ÑÒ»¸öexcelÎļþ°´ÕÕijһÁÐÖеÄ×ֶβð·Ö³É¶à¸öÎļþ£¬ÀýÈç°´ÕÕ³ÇÊлòÕßÊ¡·ÝµÈ£¬µ«ÊÇ·¢ÏÖ´¦ÀíÒ»¸ö1700ÐеÄÎļþ²ð·Ö³É40¶à¸öÎļþʱҪÔËÐÐ30·ÖÖÓ×óÓÒ£¬ÐÔÄÜÌ«Âý£¬Çë¸ßÊÖ°ïæ¿´¿´Ôõô²ÅÄÜÓÅ»¯ÐÔÄÜ£¬Ð»Ð»¡£
ÐÂÊÖдµÄ½Å±¾£¬Çë²»Òª¼ûЦ£¬ÈçÏ£º
'''
Created on 2009-9-25
@author: vidon
'''
#_*_ coding:UTF-8 _*_
import os, sys, time
import win32com.client
xls=win32com.client.Dispatch("Excel.Application")
xls.Visible=False
source_path = input('ÇëÊäÈëÒª²Ù×÷µÄÎļþÃû·¾¶ÓëÃû³Æ£¨ÀýÈ磺D:\ABC\BOOK.XLS£©£º').replace('\r','')
target_path = input('ÇëÊäÈë´æ·ÅÊý¾Ý´¦Àí½á¹ûµÄĿ¼£¨ÀýÈ磺D:\BACK\)£º').replace('\r','')
x=int(input("ÇëÊäÈë±íÍ·µÄÐÐÊý£º").replace('\r',''))
y=int(input("ÇëÊäÈë×÷Ϊ²ð·ÖÊý¾ÝµÄÒÀ¾ÝËùÔÚÁеĺÅÂ룺").replace('\r',''))
if not os.path.exists(target_path):
os.mkdir(target_path)
print("ÒѾ´´½¨Ö¸¶¨µÄĿ¼£¬×¼±¸´´½¨Îļþ£¬ÇëÉԵȷ·····")
else:
print("×¼±¸´´½¨Îļþ£¬ÇëÉԵȷ·····")
#¶ÁÈ¡ÔʼÎļþ
book=xls.Workbooks.Open(source_path)
sheet=book.ActiveSheet
length = sheet.UsedRange.Rows.Count
y_length = sheet.UsedRange.Columns.Count
keyArray = []
for i in range((x+1),length):
keyArray.append(sheet.Cells(i,y).Value)
#¸ù¾ÝÖ¸¶¨µÄÁÐÖеÄ×ֶδ´½¨ÐÂÎļþ
ll = len(keyArray)
for j in range(1,ll):
filename = target_path + str(keyArray[j]) + ".xls"
if os.path.exists (filename):
continue
else :
sheet.Range(sheet.Cells(1,1),sheet.Cells(x,y_length)).select
sheet.Range(sheet.Cells(1,1),sheet.Cells(x,y_length)).copy
newbook = xls.Workbooks.Add()
&nb
Ïà¹ØÎĵµ£º
1. Building an Application with PyGTK and Glade
2. Creating a GUI using PyGTK and Glade
3. A Beginner's Guide to Using pyGTK and Glade
4. Is there a walkthrough on getting PyGTK2 and libglade2 to work on win32 ......
ÔÚWindowsÀï´î½¨PythonµÄGTK+»·¾³»¹ÊDZȽÏÂé·³µÄÓÐÒÔϼ¸¸ö×¢ÒâÊÂÏî
1¡¢PyGTKÍøÕ¾ÉÏϵİü£¬¿ÉÄÜûÓÐGladeÀࣨLib\site-packages\gtk-2.0\gtkĿ¼ÏÂûÓÐglade.pyd£©£¬Èç¹ûûÓÐÕâ¸öÀàÄã¾ÍÎÞ·¨ÔÚ³ÌÐòÀïµ¼ÈëGlade¹¤¾ß´´½¨µÄxml£¬ÊÖд½çÃ滹ÊÇͦÂé·³µÄ¡£
2¡¢GTKÍøÕ¾ÉϵÄGTK°ü£¬Ã»ÓаüÀ¨GladeµÄDLLÎļþ£¬»¹ÊÇÎÞ·¨¶ÁÈëGladeµÄxm ......
1.PythonÖÐʱ¼äº¯ÊýÓм¸ÖÖ²»Í¬µÄ±íʾ·½·¨¡£Ò»ÖÖÊÇ»ùÓÚÊý×ֵıíʾ·½·¨£¬ÁíÍâÒ»ÖÖÊÇÓÃһϵÁÐÖµÀ´±íʾ£¬µÚÈýÖÖÊÇÓÃASCIIÂë×Ö·û´®µÄ¿É¶ÁÐÎʽÀ´±íʾµÄÔª×é¡£ time()º¯Êý·µ»ØµÄÊÇ´Óijһʱ¼äµãËãÆðµÄÃëÊý£¬¸ÃÊýÖµÊÇÒ»¸ö¸¡µãÊý¡£¸ù¾Ý²Ù×÷ϵͳµÄ²»Í¬£¬Õâ¸öʱ¼äµãÒ²²»Í¬¡£Í¨¹ýÇólocaltime(0)µÄÖµ¿ÉÒÔÕÒµ½ÏµÍ³µÄ¸Ãʱ¼äµã¡£ localtime ......
http://cocobear.info/blog/2009/01/16/use-python-deal-with-excel/
ʹÓÃPython´¦ÀíExcel±í¸ñ 2009Äê01ÔÂ16ÈÕ
¸ø°³µÄbossдµÄÒ»¸öС¹¤¾ß£¬Ê¹ÓÃPython¶ÔExcel½øÐÐͳ¼Æ£¬È»ºó°Ñ½áÊøÉú³ÉÒ»¸öеÄExcel±í¸ñ£¬Ê¹Óõ½ÁËxlrdºÍpyExceleratorÁ½¸ö¿â¡£
¼òµ¥µÄ½éÉÜÒ»ÏÂÕâÁ½¸ö¿â£¬ÏÈ˵xlrd£¬Õâ¸ö¿â¶ÁExcel±È½Ï·½±ã£¬¸÷ÖÖ·½·¨Ê¹ÓÃÆ ......
¹Ø¼ü×Ö: python com ±¨¸æ
http://appofis.javaeye.com/blog/417446
python ²Ù×÷ms office Éú³É±¨¸æÏà¹Ø×ܽá
I. ÏîÄ¿ÖÐÐèÒªÉú³ÉwordºÍexcel±¨¸æ£¬Í¨³£ÓÐÁ½ÖÖ·½·¨£º»ùÓÚ×Ö·û´®Æ´½ÓÒÔ¼°COMµ÷Óá£
1) ×Ö·û´®Æ´½ÓÉú³ÉofficeÎĵµµÄÔÀí£º officeÎĵµ±¾Éí¿ÉÒÔÌåÏÖΪxmlÎļþ¸ñʽ£¬ÓÈÆäÊÇMS Excel
2003£¬ÎÒÃÇ¿ÉÒÔ×Ô¼º½«Ò» ......