pythonµÄÒì³£Exception
Python µÄÒì³£´¦Àí»úÖÆ
Python´úÂë
try:
raise Exception("a", "b")
except Exception,e:
print e
finally:
print "final"
('a', 'b')('a', 'b')
final
ͬÑù¿ÉÒÔ´¦Àí¶à¸öÒ쳣ɸѡ¡£
Python´úÂë
try:
raise EOFError("aa", "bb")
except RuntimeError, e:
print "[RuntimeErro]: ", e
except EOFError, e:
print "[EOFError]: ", e
except Exception, e:
print "[Error]: ", e
finally:
print "final"
[EOFError]: ('aa', 'bb')
final
³ýÁËÒì³£²ÎÊý£¬ÎÒÃÇ»¹¿ÉÒÔÓÃsysµÄһЩ·½·¨À´»ñÈ¡Òì³£ÐÅÏ¢¡£
Python´úÂë
import sys
try:
raise RuntimeError("the runtime error raised")
except:
print sys.exc_info()
(<type 'exceptions.RuntimeError'>, RuntimeError('the runtime error raised',), <traceback object at 0x00DC5CB0>)
ȱʡÇé¿öÏ£¬Òì³£À඼¼Ì³Ð×Ô Exception¡£
Python´úÂë
>>>>>> class MyException(Exception):
pass
>>>>>> try:
raise MyException("My Exception raised!")
except:
print sys.exc_info()
(<class '__main__.MyException'>, MyException('My Exception raised!',), <traceback object at 0x00DC58F0>)
>>>>>>
Ïà¹ØÎĵµ£º
¹Ø¼ü×Ö: python com ±¨¸æ
http://appofis.javaeye.com/blog/417446
python ²Ù×÷ms office Éú³É±¨¸æÏà¹Ø×ܽá
I. ÏîÄ¿ÖÐÐèÒªÉú³ÉwordºÍexcel±¨¸æ£¬Í¨³£ÓÐÁ½ÖÖ·½·¨£º»ùÓÚ×Ö·û´®Æ´½ÓÒÔ¼°COMµ÷Óá£
1) ×Ö·û´®Æ´½ÓÉú³ÉofficeÎĵµµÄÔÀí£º officeÎĵµ±¾Éí¿ÉÒÔÌåÏÖΪxmlÎļþ¸ñʽ£¬ÓÈÆäÊÇMS Excel
2003£¬ÎÒÃÇ¿ÉÒÔ×Ô¼º½«Ò» ......
http://bbs.chinaunix.net/thread-1586782-1-1.html
ÎÒ¸Õ¸ÕÓÃpythonдÁËÒ»¶Î²Ù×÷excelµÄ½Å±¾£¬Ä¿µÄÊÇ°ÑÒ»¸öexcelÎļþ°´ÕÕijһÁÐÖеÄ×ֶβð·Ö³É¶à¸öÎļþ£¬ÀýÈç°´ÕÕ³ÇÊлòÕßÊ¡·ÝµÈ£¬µ«ÊÇ·¢ÏÖ´¦ÀíÒ»¸ö1700ÐеÄÎļþ²ð·Ö³É40¶à¸öÎļþʱҪÔËÐÐ30·ÖÖÓ×óÓÒ£¬ÐÔÄÜÌ«Âý£¬Çë¸ßÊÖ°ïæ¿´¿´Ôõô²ÅÄÜÓÅ»¯ÐÔÄÜ£¬Ð»Ð»¡£
ÐÂÊÖдµÄ½Å±¾£¬Çë²» ......
ÀµÓºÆ(http://blog.csdn.net/lanphaday) Òë
ÒëÕß°´£ºPython¡¢luaºÍrubyÔÚC/C++ÊÇÈÕ½¥Ê½Î¢µÄÇé¿öÏ£¬ÔÚjava/.netµÄΧ¼ßÖÐŬÁ¦¿¹ÕùµÄÈý¸öµ±ºìСÉú¡£ÔÚTom GutschmidtµÄÖø×÷¡¶Game Programmng with Python, Lua and Ruby¡·Ò»ÊéÖУ¬½éÉÜÁËÈýÖÖÓïÑÔÔÚÓÎÏ·ÖеÄÓ¦Óã¬ÆäÖÐÓÈΪÁ˲»ÆðµÄÊÇÔÚÊéÖÐ×îºóÒ»ÕÂÖбȽÏÁËÈýÖֽű¾£¬×÷Õßà ......
תÌû£º
http://blog.csdn.net/wyingquan/archive/2008/12/20/3561094.aspx
ÓÃpython×Ô´øµÄbinasciiÄ£¿é¼ÆËã×Ö·û´®µÄУÑéÂ룬³öÀ´µÄÊǸºÖµ£¬ÓëÓÃcдµÄ³ÌÐòµÃ³öµÄУÑéÂë²»Ò»Ñù£¬ËùÒÔ¾ÍÑо¿ÁËһϡ£·¢ÏÖ±ðÈËÓõÄpython3.0°æ±¾binasciiÄ£¿é¼ÆËã³öµÄcrc32УÑéÂëÊÇÎÒÏëÒªµÄ£¬Ã»°ì·¨Ö»ºÃ×Ô¼ºÓÃpythonʵÏÖÒ»ÏÂcrc32µÄËã·¨ÁË¡£·¢ ......