PythonÒì³£´¦ÀíÌåϵ¼ò½é
PythonÄÚ½¨Òì³£Ìåϵ½á¹¹
BaseException
+--¡¡SystemExit
+--¡¡KeyboardInterrupt
+--¡¡GeneratorExit
+--¡¡Exception
+--¡¡StopIteration
+--¡¡StandardError
|¡¡¡¡¡¡¡¡+--¡¡BufferError
|¡¡¡¡¡¡¡¡+--¡¡ArithmeticError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡FloatingPointError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡OverflowError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡ZeroDivisionError
|¡¡¡¡¡¡¡¡+--¡¡AssertionError
|¡¡¡¡¡¡¡¡+--¡¡AttributeError
|¡¡¡¡¡¡¡¡+--¡¡EnvironmentError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡IOError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡OSError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡+--¡¡WindowsError¡¡(Windows)
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡+--¡¡VMSError¡¡(VMS)
|¡¡¡¡¡¡¡¡+--¡¡EOFError
|¡¡¡¡¡¡¡¡+--¡¡ImportError
|¡¡¡¡¡¡¡¡+--¡¡LookupError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡IndexError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡KeyError
|¡¡¡¡¡¡¡¡+--¡¡MemoryError
|¡¡¡¡¡¡¡¡+--¡¡NameError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡UnboundLocalError
|¡¡¡¡¡¡¡¡+--¡¡ReferenceError
|¡¡¡¡¡¡¡¡+--¡¡RuntimeError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡NotImplementedError
|¡¡¡¡¡¡¡¡+--¡¡SyntaxError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡+--¡¡IndentationError
|¡¡¡¡¡¡¡¡|¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡+--¡¡TabError
|¡¡¡¡¡¡¡¡+--¡¡SystemError
|¡¡¡¡¡¡¡¡+--¡¡TypeError
|¡¡¡¡¡¡¡¡+--¡¡ValueError
|¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡+--¡¡UnicodeError
|¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡+--¡¡UnicodeDecodeError
|¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡+--¡¡UnicodeEncodeError
|¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡+--¡¡UnicodeTranslateError
+--¡¡Warning
+--¡¡DeprecationWarning
+--¡¡PendingDeprecationWarning
+--¡¡RuntimeWarning
+--¡¡SyntaxWarning
+--¡¡UserWarning
+--¡¡FutureWarning
+--¡¡ImportWarning
+--¡¡UnicodeWarning
+--¡¡BytesWarning
²¶»ñÒì³£µÄ·½Ê½
·½·¨Ò»£º²¶»ñËùÓеÄÒì³£
¡¡'''¡¡²¶»ñÒì³£µÄµÚÒ»ÖÖ·½Ê½£¬²¶»ñËùÓеÄÒì³£¡¡'''
try:
a¡¡=¡¡b
b¡¡=¡¡c
except¡¡Exception,data:
print¡¡Exception,":",data
'''Êä³ö£º£¼type¡¡'exceptions.Exception'£¾¡¡:¡¡local¡¡variable¡¡'b'¡¡
referenced¡¡before¡¡assignment¡¡''
·½·¨¶þ£º²ÉÓÃtracebackÄ£¿é²é¿´Òì³££¬ÐèÒªµ¼ÈëtracebackÄ£¿é
'''¡¡²¶»ñÒì³£µÄµÚ¶þÖÖ·½Ê½£¬Ê¹ÓÃtraceback²é¿´Òì³£¡¡'''
try:
a¡¡=¡¡b
b¡¡=¡¡c
except:
print¡¡traceback.print_exc()
'''Êä³ö
Ïà¹ØÎĵµ£º
ÏÂÔØµÄPDFÎĵµÖÐÓеÄÃüÃûºÜÂÒ£¬¾ÍÏëÆðÁË×Ô¼ºÐ´¸ö³ÌÐò£¬È»ºó¶ÁÈ¡PDFµÄtitleÊôxing£¬¸ù¾ÝÕâ¸öÊôxing£¬¸ü¸Ä´ÎÎĵµµÄÃû×Ö£¡ÒÔÏÂÊÇ´úÂ룺
ÐèÒªµ½£ºhttp://pybrary.net/pyPdf/ÉÏÃæÏÂÔØ¶ÔӦƽ̨µÄPDFµÄ¿âÎļþ£¬È»ºó°²×°£¬µ¼Èë¡£
#encoding:utf-8
import os
import operator
from pyPdf import PdfFileWriter, PdfFileReader ......
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±È½Ï·½±ã£¬¸÷ÖÖ·½·¨Ê¹ÓÃÆ ......
http://www.autohotkey.com/forum/topic53773.html
Q:I am searching for is a way to execute AHK commands from a Python script. Is this possible?
A:Yes. Here is an example.
tested with python2.6, requires AutoHotkey.dll in the working directory or path...
ahkpython.py:
#Persistent
dllc ......
ÓÉÓÚ¹¤×÷ÐèÒª£¬ÓÖҪѧϰеĿª·¢ÓïÑÔ-Python£¬ ÓïÑÔѧ¹ý¼¸ÖÖÁË£¬ ¸Ð¾õ»¹ÊÇÓкöàÏàËÆµÄµØ·½£¬ Õâ¸öPython¸Ð¾õ¾Í¸úJavaÓкöàÏàͨµÄµØ·½£¬ Ê×ÏÈÄã¿ÉÒÔÔÚEclipseÉÏͨ¹ýÅäÖúóÀ´¿ª·¢Python¡£ÕâÀïÎÒÌý´ÓÁËÀÏ´óµÄ½¨Ò飬ÅäÖÃÁËÒ»¸öFlexBuilder ×÷ΪPythonµÄIDE½øÐпª·¢¡£
Ŀǰ¸Õ¿ªÊ¼Ñ§Ï°PythonµÄ»ù±¾Óï·¨£¬ ½ñÌìÖ÷Òª¿´ÁËÒ»ÏÂPyth ......
RubyºÍPythonµÄÓï·¨±È½Ï
ÆäʵRubyºÍPython·Ç³£½Ó½ü£¬±È´ó¶àÊý±ðµÄÓïÑÔÒª½Ó½üµÄ¶à£¬ËùÒÔϲ»¶ÓÃɶ¾ÍÓÃɶ£¨´óʵ»°£¬ËäȻҲÊÇ·Ï»°£©¡£Óï·¨ÉϵIJî±ðËäÈ»ÓÐÄÇôһµã£¬´ó²¿·ÖÊÇsyntax sugar£¬ÎÒ¶·µ¨ÉÔ΢Áм¸¸ö£¨pythonÎÒÒ²ÍüµÃ²î²»¶àÁË£¬²»¶ÔµÄ´ó¼Ò¾¡¹ÜÀ´±Þʬ°É£©£¬µ«ÊÇÖ÷Òª²îÒ컹ÊÇÉè¼ÆË¼ÏëÉϵģºÁé»î ......