Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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()
'''Êä³ö


Ïà¹ØÎĵµ£º

python timeÄ£¿éÏê½â

 python µÄÄÚǶtimeÄ£°å·­Ò뼰˵Ã÷
 
Ò»¡¢¼ò½é
  timeÄ£¿éÌṩ¸÷ÖÖ²Ù×÷ʱ¼äµÄº¯Êý
  ˵Ã÷£ºÒ»°ãÓÐÁ½ÖÖ±íʾʱ¼äµÄ·½Ê½:
       µÚÒ»ÖÖÊÇʱ¼ä´ÁµÄ·½Ê½(Ïà¶ÔÓÚ1970.1.1 00:00:00ÒÔÃë¼ÆËãµÄÆ«ÒÆÁ¿),ʱ¼ä´ÁÊÇΩһµÄ
       µÚ¶þÖÖÒÔÊý× ......

Èà easy_install ʹÓôúÀí·­Ç½°²×° Python Ä£¿é

ÀµÓºƣ¨http://laiyonghao.com£©
¹Ø¼ü×Ö£ºpython, easy_install, setuptools, myentunnel, polipo, windows, linux, socks5, http, proxy
ÒòΪһЩÖÚËùÖÜÖªµÄÔ­Òò£¬ÎÒÃÇÓÐÐ©ÍøÕ¾ÎÞ·¨·ÃÎÊ£¬Ôì³ÉÉú»îºÍÉú²úµÄ¾Þ´ó²»±ã¡£ÆäÖжÔÎÒÓ°Ïì±È½Ï´óµÄÒ»¸ö¾ÍÊǰ²×°Ä³Ð© Python Ä£¿éµÄʱºò£¬easy_install ÎÞ·¨·ÃÎʵ½ÍøÕ¾¡£ÔÚÕâÀï·ÖÏíÈ ......

pythonдµÄ½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z¸ñʽ

#½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z.py
#for folder all file do 7z
import os
import sys
import distutils.file_util
def ImportOkFile():
    if(os.path.isfile("D:\\Records\\½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z_record.txt")==False):
        f=open("D:\\Reco ......

pythonµÄÒì³£Exception


Python µÄÒì³£´¦Àí»úÖÆ
Python´úÂë 
 try:    
  raise Exception("a", "b")    
    except Exception,e:    
  print e    
    finally:    
  print "final"    
('a', ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ