PythonÓëMicrosoft Office×Ô¶¯»¯²Ù×÷
http://www.cnblogs.com/Jedimaster/archive/2007/02/28/660209.html
¡¡¡¡ÅóÓѵļÒÈË×öÉúÒ⣬ÿÈÕ´Ó¸÷µØ·Öµê´¦ÊÕ¼¯±¨±í£¬È»ºó»ØÈ¥»ã×Ü¡£ÓÉÓÚ²»ÏëÓÃÄÇÖÖ¸´ÔӵĹÜÀíÈí¼þ£¬¾Í½ÐËûдһ¸öС¹¤¾ß¡£ÓÚÊÇËûÕÒµ½ÁËÎÒ£¬ÈÃÎÒÏëÏë°ì·¨¡£
¡¡¡¡PythonÊǸöÁîÈ˾ªÆæµÄ¹¤¾ß£¬¶ø²»½ö½öÊÇÒ»ÖÖÓïÑÔ¡£¶Ô±ÈÀÏÅƵÄPerl£¬¿´ËÆPython²»ÊÇÄÇôµÄ¾«Í¨ —— ¶Ô±ÈPerl³¬¿ìµÄÎı¾´¦ÀíËٶȺ͹㷺ӦÓÃÓÚCgi³ÌÐòµÄ±àдÀúÊ·£¬ÒÔ¼°Ä¿Ç°´óºì´ó×ϵÄRubyÔÚWeb¿ª·¢ÉϵIJ¡¶¾Ê½ÂûÑÓ£¬¶ø±ÈÆð¾²Ì¬ÓïÑÔ±ÈÈçC\C++£¬ÐéÄâ»úJavaºÍC#À´Ëµ£¬ËÙ¶ÈÓÖ³ÉÁËÎÊÌâ¡£µ«ÊÇPythonµÄʵÁ¦¿É²»ÈÝСÊÓ£¬NASA¶¼ÓÃPython¿É²»ÊÇ´µµÄ£¬¿öÇÒ£¬PythonµÄѧϰÄѶȱÈPerlС¶àÁË£¬¸ÕѧʱÈÃÎÒÕÒµ½ÁËÒÔÇ°QBASICµÄ¸Ð¾õ¡£
¡¡¡¡
¡¡¡¡´Ë³ÌÐò¾ßÌåÒªÇóÈçÏ£ºÃ¿ÈÕ²úÉú¸±±íÈô¸É£¨È縱±íÎļþ£©¡£³ÌÐòÏȺ˶Ը½±íµÄÈÕÆÚºÍÏúÊ۵㡣Èç¹ûÏúÊ۵㲻ͬÈÕÆÚÏàͬ£¬±ã°Ñ²»Í¬¸±±íµÄÏàͬ²úÆ·ºÅµÄ “ÏúÊÛÊýÁ¿”À¸Ïà¼Ó£¬ÌîÈë×ܱí“ÏúÊÛÊýÁ¿”À¸¡£½«¸±±íµÄ“×ÜÀûÈó”À¸Ïà¼ÓÌîÈë×ܱíµÄ“×ÜÀûÈó”À¸¡£ÆäËû¸±±íÐÅÏ¢¸´ÖƵ½×Ü±í£¨±¸×¢³ýÍâ,ÓÉÓû§×ÔÐд¦Àí£©¡£±íÍ·µÄÑùʽÈçÏ£º
¡¡¡¡°¡¹þ£¬ºÜ¼òµ¥µÄ±íÍ·¡£ÆäÖÐÐèÒª²Ù×÷µÄÊÇ“ÏúÊÛÊýÁ¿”ºÍ“×ÜÀûÈ󔣬Ҳ¾ÍÊÇ°ÑÏàͬʱ¼äµÄ±¨±íÏà¼Ó¡£µ«ÊÇÕâÑùÓиöÑÏÖØÎÊÌ⣡
±ØÐëÒªÇó£¬Ïàͬ±¨±íµÄ²úÆ·Ãû³Æ¡¢»õºÅµÄ˳Ðò²»Äܳö´í£¬¸÷µØÒª¾ø¶Ôͳһ£¬·ñÔòÈ«²¿ÕâÑùÕÕÑù¿½±´¾Í»á³ö´í£¡
¡¡¡¡ÈÃÎÒÃÇ·ÖÎöÒ»ÏÂ˼·£ºÊ±¼äÊǹؼü¡£Ê±¼ä¾ö¶¨ÁËÄÄЩ±¨±íÐèÒª·ÖÃűðÀ࣬Éú³ÉÄÄÒ»ÌìµÄͳ¼Æ×Ü±í¡£Êý¾Ý½á¹¹ÉÏ£¬ÓÃʲôÄØ£¿¼òµ¥µÄlist£¿²»ÐУ¬ÎÒ³¢ÊÔ¹ý¡£Ó¦¸ÃʹÓÃmapÈÝÆ÷£¬°ÑÈÕÆÚ×÷Ϊkey£¬´¢´æµÄValueÊǸöÁÐ±í¡£³ÌÐòÏÈɨÃèËùÓеÄExcelÎļþ»ñÈ¡ÈÕÆÚ£¬È»ºó°ÑÏàͬÈÕÆÚ±¨±íµÄCOMÎĵµ½Ó¿Ú´¢´æÆðÀ´£¬ÊµÏÖÁË·ÖÃűðÀà¡£×îºó±éÀúÕâ¸ömapÈÝÆ÷£¬¼ÆË㣬Éú³ÉÿÈÕµÄͳ¼Æ×Ü±í¡£´úÂëÈçÏ£¬¾¹ý²âÊÔÕý³£¡£
1import os;
2import sys;
3import time;
4import datetime;
5#ÇëÏÈ°²×°¶ÔÓ¦×ÅÄã×Ô¼ºµÄPython°æ±¾µÄPythonWin32
6import win32com.client;
7
8
9mapper = {};
10
11app = win32com.client.Dispatch("Excel.Application");
12PipeOut = os.popen("dir *.xls /B");
13FileList = PipeOut.readlines();
14PipeOut = os.popen("cd
Ïà¹ØÎĵµ£º
# coding=gb2312
# ÓÃÖÐÎÄ×¢ÊÍÇ°Îñ±Ø¼ÓÉϵÚÒ»ÐÐ
# ÇóÄ£ÔËËã·û£¬ºÍCÓïÑÔÒ»Ñù
print 10%9
# ÕûÊýÏà³ýÈÔÈ»ÊÇÕûÊý
print 5/2
# 2ºó¼ÓÉÏ.¾Í±ä³É¸¡µãÊýÁË
print 5/2.
# **±íʾÇóÃÝÔËËã
print 7**4
# º¯ÊýÓÃʱҪ¼ÓÉÏmodule.function
import math
print math.floor(19.8)
# º¯ÊýÃûÒ²¿ÉÒÔ³ÉΪ±äÁ¿
func = math.floor
......
ÔÚ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 ......
ʱ³£¼ûµ½Ò»Ð©ºÃµÄPythonÄ£¿é£¬Èç¹û²»Ëæʱ¼ÇÏ£¬µÈÓõÄʱºòÓÖÊÇÒ»ÕóÂÒ·£¬ºÃÔÚPythonÒýÓÃÒ»¸öÄ£¿é¼«Æä·½±ã£¬OK£¬·Ï»°ÉÙ˵£º
1. decimal
±ê׼ģ¿é£¬2.4ÒýÈ룬ÓÃÓÚ¸¡µãÊýµÄ¾«È·±íʾ£º
>>> 0.1 + 0.1 + 0.1 - 0.3
5.5511151231257827e-17
>>> from decimal import Decimal
>>> def _(x): retu ......
³õѧpython£¬ÏÖÔÚÒª¶ÁÒ»¸ö¶þ½øÖÆÎļþ£¬²éÕÒdocÖ»·¢ÏÖfileÌṩÁËÒ»¸öreadºÍwriteº¯Êý£¬¶øÇÒ¶ÁдµÄ¶¼ÊÇ×Ö·û´®£¬Èç¹ûÖ»ÊǶÁдcharµÈÒ»¸ö×ֽڵĻ¹ÐУ¬ÒªÏë¶ÁдÈçint,doubleµÈ¶à×Ö½ÚÊý¾Ý¾Í²»·½±ãÁË¡£ÔÚÍøÉϲ鵽һƪÌù×Ó£¬Ê¹ÓÃstructÄ£¿éÀïÃæµÄpackºÍunpackº¯Êý½øÐжÁд¡£ÏÂÃæ¾Í×Ô¼ºÐ´´úÂëÑé֤һϡ£
>>> from struct ......
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±È½Ï·½±ã£¬¸÷ÖÖ·½·¨Ê¹ÓÃÆ ......