Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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¡¢LuaºÍRuby


ÀµÓºÆ(http://blog.csdn.net/lanphaday) Òë
ÒëÕß°´£ºPython¡¢luaºÍrubyÔÚC/C++ÊÇÈÕ½¥Ê½Î¢µÄÇé¿öÏ£¬ÔÚjava/.netµÄΧ¼ßÖÐŬÁ¦¿¹ÕùµÄÈý¸öµ±ºìСÉú¡£ÔÚTom GutschmidtµÄÖø×÷¡¶Game Programmng with Python, Lua and Ruby¡·Ò»ÊéÖУ¬½éÉÜÁËÈýÖÖÓïÑÔÔÚÓÎÏ·ÖеÄÓ¦Óã¬ÆäÖÐÓÈΪÁ˲»ÆðµÄÊÇÔÚÊéÖÐ×îºóÒ»ÕÂÖбȽÏÁËÈýÖֽű¾£¬×÷Õßà ......

PythonÖеÄһЩÒì³£

ÆäʵÒì³£¾ÍÊDz»Õý³££¬¾ÍÊDz»ºÍÎÒÃÇÏëÏóÒ»ÑùÈ¥Ö´ÐС£ËüÊÇÒòΪ³ÌÐò³öÏÖÁË´íÎó¶øÔÚÕý³£¿ØÖÆÁ÷ÒÔÍâ²ÉÈ¡µÄÐÐΪ¡£Python³öÏÖÒì³££¬¾ÍÊÇÒòΪ¼ì²éÁËÒ»¸ö´íÎóʱ£¬Python½âÊÍÆ÷ÎÞ·¨¼ÌÐø¼ÌÐøÖ´ÐÐÏÂÈ¥£¬ÕâʱºòÅ׳öÁËÒì³£¡£ÍùÍùÕâ¸ö´íÎó·ÖΪÓï·¨ÉϺÍÂß¼­ÉÏ(²»Éó¤Ëµ¸ÅÄ-_-! )£¬¿´¿´¼¸¸öÀý×Ó£¬×ܽáһϣº
1¡¢NameError£º³¢ÊÔ·ÃÎÊÒ»¸öÎ ......

PythonÄ£¿éѧϰ urllib


    urllibÄ£¿éÌṩµÄÉϲã½Ó¿Ú£¬Ê¹ÎÒÃÇ¿ÉÒÔÏñ¶ÁÈ¡±¾µØÎļþÒ»Ñù¶ÁÈ¡wwwºÍftpÉϵÄÊý¾Ý¡£Ã¿µ±Ê¹ÓÃÕâ¸öÄ£¿éµÄʱºò£¬ÀÏÊÇ»áÏëÆð¹«Ë¾²úÆ·µÄ¿Í»§¶Ë£¬Í¬ÊÂÓÃC++ÏÂÔØWebÉϵÄͼƬ£¬ÄÇÖÖ“Í´¿à”µÄ±íÇé¡£ÎÒÒÔÇ°·­Òë¹ýlibcurl½Ì³Ì£¬ÕâÊÇÔÚC/C++»·¾³Ï±ȽϷ½±ãʵÓõÄÍøÂç²Ù×÷¿â£¬Ïà±ÈÆðlibcurl£¬PythonµÄurl ......

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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ