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>)
>>>>>>
Ïà¹ØÎĵµ£º
CSDNÕ¾ÄÚתÌû£º
http://blog.csdn.net/kiki113/archive/2009/03/28/4033017.aspx
python µÄÄÚǶtimeÄ£°å·Ò뼰˵Ã÷
Ò»¡¢¼ò½é
timeÄ£¿éÌṩ¸÷ÖÖ²Ù×÷ʱ¼äµÄº¯Êý
˵Ã÷£ºÒ»°ãÓÐÁ½ÖÖ±íʾʱ¼äµÄ·½Ê½:
µÚÒ»ÖÖÊÇʱ¼ä´ÁµÄ·½Ê½(Ïà¶ÔÓÚ1970.1.1 00:00:00ÒÔÃë¼ ......
ÆäʵÒì³£¾ÍÊDz»Õý³££¬¾ÍÊDz»ºÍÎÒÃÇÏëÏóÒ»ÑùÈ¥Ö´ÐС£ËüÊÇÒòΪ³ÌÐò³öÏÖÁË´íÎó¶øÔÚÕý³£¿ØÖÆÁ÷ÒÔÍâ²ÉÈ¡µÄÐÐΪ¡£Python³öÏÖÒì³££¬¾ÍÊÇÒòΪ¼ì²éÁËÒ»¸ö´íÎóʱ£¬Python½âÊÍÆ÷ÎÞ·¨¼ÌÐø¼ÌÐøÖ´ÐÐÏÂÈ¥£¬ÕâʱºòÅ׳öÁËÒì³£¡£ÍùÍùÕâ¸ö´íÎó·ÖΪÓï·¨ÉϺÍÂß¼ÉÏ(²»Éó¤Ëµ¸ÅÄ-_-! )£¬¿´¿´¼¸¸öÀý×Ó£¬×ܽáһϣº
1¡¢NameError£º³¢ÊÔ·ÃÎÊÒ»¸öÎ ......
urllibÄ£¿éÌṩµÄÉϲã½Ó¿Ú£¬Ê¹ÎÒÃÇ¿ÉÒÔÏñ¶ÁÈ¡±¾µØÎļþÒ»Ñù¶ÁÈ¡wwwºÍftpÉϵÄÊý¾Ý¡£Ã¿µ±Ê¹ÓÃÕâ¸öÄ£¿éµÄʱºò£¬ÀÏÊÇ»áÏëÆð¹«Ë¾²úÆ·µÄ¿Í»§¶Ë£¬Í¬ÊÂÓÃC++ÏÂÔØWebÉϵÄͼƬ£¬ÄÇÖÖ“Í´¿à”µÄ±íÇé¡£ÎÒÒÔÇ°·Òë¹ýlibcurl½Ì³Ì£¬ÕâÊÇÔÚC/C++»·¾³Ï±ȽϷ½±ãʵÓõÄÍøÂç²Ù×÷¿â£¬Ïà±ÈÆðlibcurl£¬PythonµÄurl ......
ת×Ô£º
http://hi.baidu.com/feng2211/blog/item/8b86b6d9816a3f2710df9b79.html
ºÍ
http://i.19830102.com/archives/164
Python °æ±¾£º2.6
ÏÂÔصØÖ·£ºhttp://www.python.org/download/releases/2.6.1/
ÏÂÔØmsiÎļþ²¢°²×°
MySQLdb°æ±¾£º MySQL-python-1.2.2.win32-py2.6.exe
ÏÂÔصØÖ·£ºhttp://home.netimperia.com/ ......